Electron.NET
Electron.NET copied to clipboard
Application crashes on start
- Version: 23.6.2
.NET 8, Node.js 20.13.0
- Target: win
I am using Azure DevOps pipelines to build and deploy the application to a VM. When I start the application on the VM, it almost instantly crashes. I can see the CPU usage jumping to 100% and then the process stops. The same application built on my local machine and then copied to the VM works correctly. The pipeline is configured to use the exact configuration as my local machine (except for the Windows version).
The crash is likely related to electron because the application is configured to run DB migrations before creating the Electron window, which are successfully applied.
I figure the issue might be related to environment differences. Could it be an issue with building the application on Windows Server? Any help is appreciated.
Thanks!
Here is the log from the Event Viewer:
Faulting application name: app.exe, version: 1.0.0.0, time stamp: 0x6402a76f
Faulting module name: app.exe, version: 1.0.0.0, time stamp: 0x6402a76f
Exception code: 0x80000003
Fault offset: 0x00000000018d4e14
Faulting process id: 0x1454
Program.cs
builder.Services.AddElectron();
builder.WebHost.UseElectron(args);
var app = builder.Build();
await app.Services.InitializeDatabaseAsync();
app.MapRazorComponents<UI.Components.App>()
.AddInteractiveServerRenderMode();
await app.StartAsync();
var window = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Width = 1600,
MinWidth = 800,
Height = 1100,
MinHeight = 500,
HasShadow = false,
Center = true,
AutoHideMenuBar = true,
Frame = false
});
window.OnClosed += Electron.App.Quit;
await Electron.IpcMain.On("minimize-window", (e) =>
{
window.Minimize();
});
await Electron.IpcMain.On("toggle-fullscreen", (e) =>
{
var isMaximized = window.IsMaximizedAsync().Result;
if (isMaximized)
{
window.Unmaximize();
}
else
{
window.Maximize();
}
});
await Electron.IpcMain.On("close-window", (e) =>
{
window.Close();
});
app.WaitForShutdown();
Steps to Reproduce: