Exceptions during splash screen / net core startup do not exit electron process #411

Closed
opened 2026-01-29 16:38:56 +00:00 by claunia · 2 comments
Owner

Originally created by @ErikApption on GitHub (Nov 6, 2019).

Originally assigned to: @GregorBiswanger on GitHub.

  • Version: 5.30.1

.net core 3.0 - no node js

  • Target: windows

Steps to Reproduce:

  1. App with long startup (~10s)
  2. Exceptions during startup leave the splash screen open and electron processes have to be manually killed

I tried doing a try/catch with Electron.App.Exit() but this did not close the electron process with the splash screen...

Originally created by @ErikApption on GitHub (Nov 6, 2019). Originally assigned to: @GregorBiswanger on GitHub. <!-- Which version of Electron.NET CLI and API are you using? --> <!-- Please always try to use latest version before report. --> * **Version**: 5.30.1 <!-- Which version of .NET Core and Node.js are you using (if applicable)? --> .net core 3.0 - no node js <!-- What target are you building for? --> * **Target**: windows <!-- Enter your issue details below this comment. --> Steps to Reproduce: 1. App with long startup (~10s) 2. Exceptions during startup leave the splash screen open and electron processes have to be manually killed I tried doing a try/catch with Electron.App.Exit() but this did not close the electron process with the splash screen...
claunia added the bug label 2026-01-29 16:38:56 +00:00
Author
Owner

@OmiCron07 commented on GitHub (Nov 28, 2019):

I got an exception when starting my application and I just find out that you can click on the splash to quit/kill the Electron processes. Same too doing Ctrl+C in the cmd box.

@OmiCron07 commented on GitHub (Nov 28, 2019): I got an exception when starting my application and I just find out that you can click on the splash to quit/kill the Electron processes. Same too doing Ctrl+C in the cmd box.
Author
Owner

@GregorBiswanger commented on GitHub (Nov 30, 2019):

We need a solution for a global exception handling in .net core... I didn´t mean the ErrorMiddleware... that is only for request/response error handling... but I don´t find a global exception handling...

You must set a try-catch block self. In the catch block you can exit the application.
Alternative, you can use the shortcut [Ctrl] + [C] in the cmd box (thx @OmiCron07) or click on splashscreen and use [Alt] + [F4].

This code works for me, to close the app with splashscreen:

Task.Run(async () =>
{
    try
    {
        throw new Exception("whaaa");
    }
    catch (Exception)
    {
        Electron.App.Exit();
        throw;
    }
                
    await Electron.WindowManager.CreateWindowAsync();
});
@GregorBiswanger commented on GitHub (Nov 30, 2019): We need a solution for a global exception handling in .net core... I didn´t mean the ErrorMiddleware... that is only for request/response error handling... but I don´t find a global exception handling... You must set a try-catch block self. In the catch block you can exit the application. Alternative, you can use the shortcut `[Ctrl] + [C]` in the cmd box (thx @OmiCron07) or click on splashscreen and use `[Alt] + [F4]`. **This code works for me, to close the app with splashscreen:** ``` Task.Run(async () => { try { throw new Exception("whaaa"); } catch (Exception) { Electron.App.Exit(); throw; } await Electron.WindowManager.CreateWindowAsync(); }); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#411