exe does not automatically exit when run from a Windows command prompt #981

Open
opened 2026-01-29 16:53:41 +00:00 by claunia · 0 comments
Owner

Originally created by @icnocop on GitHub (Aug 21, 2025).

  • Target: .net 8, Node.js v20.19.0, running on Windows 10 x64

Steps to Reproduce:

  1. Clone the main branch https://github.com/ElectronNET/Electron.NET.git
  2. Open ElectronNET.sln in Visual Studio 2022 and Build in the Debug | Any CPU solution configuration.
  3. Open a new Windows Command Prompt
  4. Run cd .\src\ElectronNET.WebApp
  5. Run "..\ElectronNET.CLI\bin\Debug\net8.0\dotnet-electronize.exe" build /target win /dotnet-configuration Debug /p:SelfContained=false /p:BuildProjectReferences=false
  6. Run cd .\src\ElectronNET.WebApp\bin\Desktop\win-unpacked
  7. Run "ElectronNET API Demos.exe"
  8. Close the "ElectronNET API Demo" window
  9. Notice the process is still running and I have to press Ctrl+C to close the process.

The issue also occurs if I try to exit the program even before calling Electron.WindowManager.CreateWindowAsync.

I expected the process to exit when all windows are closed, since Electron.WindowManager.IsQuitOnWindowAllClosed is set to true by default.

If I double-click the exe from Windows Explorer, the issue doesn't occur.

As other issues mention, I even tried:

Electron.WindowManager.IsQuitOnWindowAllClosed = false;
Electron.App.WindowAllClosed += () => Electron.App.Exit();

browserWindow.OnClosed += () =>
{
    Electron.App.Exit(0);
    Environment.Exit(0);
    Electron.App.Quit();
};

Seems related, but the issues are closed, and don't mention running on the command line:
https://github.com/ElectronNET/Electron.NET/issues/68
https://github.com/ElectronNET/Electron.NET/issues/226
https://github.com/ElectronNET/Electron.NET/issues/338
https://github.com/ElectronNET/Electron.NET/issues/346
https://github.com/ElectronNET/Electron.NET/issues/364
https://github.com/ElectronNET/Electron.NET/issues/594

Image

Thank you.

Originally created by @icnocop on GitHub (Aug 21, 2025). <!-- Which version of Electron.NET CLI and API are you using? --> <!-- Please always try to use latest version before report. --> * **Version**: commit id 9a615ca7e0d6d805ba82f3dbaa8c38e5c1bbf986 <!-- Which version of .NET Core and Node.js are you using (if applicable)? --> <!-- What target are you building for? --> * **Target**: .net 8, Node.js v20.19.0, running on Windows 10 x64 <!-- Enter your issue details below this comment. --> <!-- If you want, you can donate to increase issue priority (https://donorbox.org/electron-net) --> Steps to Reproduce: 1. Clone the `main` branch `https://github.com/ElectronNET/Electron.NET.git` 2. Open `ElectronNET.sln` in Visual Studio 2022 and Build in the `Debug | Any CPU` solution configuration. 3. Open a new Windows Command Prompt 4. Run `cd .\src\ElectronNET.WebApp` 5. Run `"..\ElectronNET.CLI\bin\Debug\net8.0\dotnet-electronize.exe" build /target win /dotnet-configuration Debug /p:SelfContained=false /p:BuildProjectReferences=false` 6. Run `cd .\src\ElectronNET.WebApp\bin\Desktop\win-unpacked` 7. Run `"ElectronNET API Demos.exe"` 8. Close the "ElectronNET API Demo" window 9. Notice the process is still running and I have to press `Ctrl+C` to close the process. The issue also occurs if I try to exit the program even before calling `Electron.WindowManager.CreateWindowAsync`. I expected the process to exit when all windows are closed, since `Electron.WindowManager.IsQuitOnWindowAllClosed` is set to `true` by default. If I double-click the exe from Windows Explorer, the issue doesn't occur. As other issues mention, I even tried: ``` Electron.WindowManager.IsQuitOnWindowAllClosed = false; Electron.App.WindowAllClosed += () => Electron.App.Exit(); browserWindow.OnClosed += () => { Electron.App.Exit(0); Environment.Exit(0); Electron.App.Quit(); }; ``` Seems related, but the issues are closed, and don't mention running on the command line: https://github.com/ElectronNET/Electron.NET/issues/68 https://github.com/ElectronNET/Electron.NET/issues/226 https://github.com/ElectronNET/Electron.NET/issues/338 https://github.com/ElectronNET/Electron.NET/issues/346 https://github.com/ElectronNET/Electron.NET/issues/364 https://github.com/ElectronNET/Electron.NET/issues/594 <img width="1171" height="390" alt="Image" src="https://github.com/user-attachments/assets/4f652927-077e-440b-925d-81472728c896" /> Thank you.
claunia added the bug label 2026-01-29 16:53:41 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#981