Electron.App.WindowAllClosed does not work #690

Closed
opened 2026-01-29 16:46:05 +00:00 by claunia · 1 comment
Owner

Originally created by @iamSmallY on GitHub (Aug 17, 2021).

  • Version: 13.5.1
  • Target: I have some functions that block the program before the Electron.App.Quit(), but I want to not call these functions when the user forcibly exits the program. So I tried to use the window-all-closed event. But when I use the Electron.App.WindowAllClosed binding the Electron.App.Exit() function, it does not exit successfully. What's more, when I use Electron.App.On() to listen on "window-all-closed" event, it works.

Steps to Reproduce:

  1. How I use Electron.App.WindowAllClosed:
Electron.App.WindowAllClosed += () => Electron.App.Exit();
  1. How I use Electron.App.On:
Electron.App.On("window-all-closed", () => Electron.App.Exit());
Originally created by @iamSmallY on GitHub (Aug 17, 2021). <!-- Please search existing issues to avoid creating duplicates. --> <!-- Which version of Electron.NET CLI and API are you using? --> <!-- Please always try to use latest version before report. --> * **Version**: 13.5.1 <!-- Which version of .NET Core and Node.js are you using (if applicable)? --> <!-- What target are you building for? --> * **Target**: I have some functions that block the program before the `Electron.App.Quit()`, but I want to not call these functions when the user forcibly exits the program. So I tried to use the `window-all-closed` event. But when I use the `Electron.App.WindowAllClosed` binding the `Electron.App.Exit()` function, it does not exit successfully. What's more, when I use `Electron.App.On()` to listen on "window-all-closed" event, it works. <!-- 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. How I use `Electron.App.WindowAllClosed`: ```C# Electron.App.WindowAllClosed += () => Electron.App.Exit(); ``` 2. How I use `Electron.App.On`: ```C# Electron.App.On("window-all-closed", () => Electron.App.Exit()); ```
claunia added the bug label 2026-01-29 16:46:05 +00:00
Author
Owner

@iamSmallY commented on GitHub (Aug 17, 2021):

After read the source code, I have changed my code like this:

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

And it works.

@iamSmallY commented on GitHub (Aug 17, 2021): After read the source code, I have changed my code like this: ```C# Electron.WindowManager.IsQuitOnWindowAllClosed = false; Electron.App.WindowAllClosed += () => Electron.App.Exit(); ``` And it works.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#690