Skip to content

Commit fa44434

Browse files
committed
asd
1 parent 16e3b3f commit fa44434

3 files changed

Lines changed: 34 additions & 15 deletions

File tree

src/ElectronNET.API/Runtime/Controllers/RuntimeControllerDotNetFirst.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ private void ElectronProcess_Stopped(object sender, EventArgs e)
8282

8383
private void HandleStopped()
8484
{
85-
if (this.socketBridge.State != LifetimeState.Stopped)
85+
if (this.socketBridge != null && this.socketBridge.State != LifetimeState.Stopped)
8686
{
8787
this.socketBridge.Stop();
8888
}
89-
else if (this.electronProcess.State != LifetimeState.Stopped)
89+
else if (this.electronProcess != null && this.electronProcess.State != LifetimeState.Stopped)
9090
{
9191
this.electronProcess.Stop();
9292
}

src/ElectronNET.API/Runtime/StartupManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,19 @@ private BuildInfo GatherBuildInfo()
132132

133133
if (electronAssembly == null)
134134
{
135+
Console.WriteLine("GatherBuildInfo: Early exit");
135136
return buildInfo;
136137
}
137138

138139
if (electronAssembly.GetName().Name == "testhost" || electronAssembly.GetName().Name == "ReSharperTestRunner")
139140
{
141+
Console.WriteLine("GatherBuildInfo: Detected testhost");
140142
electronAssembly = AppDomain.CurrentDomain.GetData("ElectronTestAssembly") as Assembly ?? electronAssembly;
141143
}
144+
else
145+
{
146+
Console.WriteLine("GatherBuildInfo: No testhost detected: " + electronAssembly.GetName().Name);
147+
}
142148

143149
var attributes = electronAssembly.GetCustomAttributes<AssemblyMetadataAttribute>().ToList();
144150

src/ElectronNET.IntegrationTests/ElectronFixture.cs

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,34 @@ public class ElectronFixture : IAsyncLifetime
1111

1212
public async Task InitializeAsync()
1313
{
14-
AppDomain.CurrentDomain.SetData("ElectronTestAssembly", Assembly.GetExecutingAssembly());
15-
var runtimeController = ElectronNetRuntime.RuntimeController;
16-
await runtimeController.Start();
17-
await runtimeController.WaitReadyTask;
18-
19-
// create hidden window for tests (avoid showing UI)
20-
this.MainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
14+
try
2115
{
22-
Show = false,
23-
Width = 800,
24-
Height = 600,
25-
}, "about:blank");
16+
Console.Error.WriteLine("InitializeAsync");
17+
AppDomain.CurrentDomain.SetData("ElectronTestAssembly", Assembly.GetExecutingAssembly());
18+
Console.Error.WriteLine("InitializeAsync 1");
19+
var runtimeController = ElectronNetRuntime.RuntimeController;
20+
Console.Error.WriteLine("InitializeAsync 2");
21+
await runtimeController.Start();
22+
Console.Error.WriteLine("InitializeAsync 3");
23+
await runtimeController.WaitReadyTask;
24+
Console.Error.WriteLine("InitializeAsync 4");
2625

27-
// Clear potential cache side-effects
28-
await this.MainWindow.WebContents.Session.ClearCacheAsync();
26+
// create hidden window for tests (avoid showing UI)
27+
this.MainWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
28+
{
29+
Show = false,
30+
Width = 800,
31+
Height = 600,
32+
}, "about:blank");
33+
34+
// Clear potential cache side-effects
35+
await this.MainWindow.WebContents.Session.ClearCacheAsync();
36+
}
37+
catch (Exception ex)
38+
{
39+
Console.WriteLine(ex);
40+
throw;
41+
}
2942
}
3043

3144
public async Task DisposeAsync()

0 commit comments

Comments
 (0)