"Exit" from popupmenu mode does not close the app
AkazaRenn opened this issue · 3 comments
Describe the bug
I know it sound ridiculous but really happened. I was testing the windowless sample here and realized the bug. Basically you just need to change ContextMenuMode="SecondWindow"
in the file to ContextMenuMode="PopupMenu"
and try exiting the app from the context menu, you'll see the tray icon is gone, but the process still stays in Task Manager, and Visual Studio does not quit debug mode either.
Steps to reproduce the bug
- Get the windowless sample from here
- Change
ContextMenuMode="SecondWindow"
in the file toContextMenuMode="PopupMenu"
- Build the app using
H.NotifyIcon
andH.NotifyIcon.WinUI
fromNuGet
- Run the app in debug mode in Visual Studio
- From tray icon, right-click to open the context menu, and hit
Exit
- Observe that Visual Studio is still in debug mode, and the process can still be found in the
Details
tab in Task Manager
Expected behavior
The app should exit just like when it's using SecondWindow
Screenshots
NuGet package version
2.0.77
Platform
WinUI
IDE
Visual Studio 2022
Windows Version
Windows 11
WindowsAppSDK Version
Other
WindowsAppSDK Type
Packaged
Manifest
No response
Additional context
No response
@AkazaRenn I think it's related to the exit command. You can debug the ExitApplicationCommand_ExecuteRequested
in App.xaml.cs
and see if there is any problem.
@AkazaRenn I think it's related to the exit command. You can debug the
ExitApplicationCommand_ExecuteRequested
inApp.xaml.cs
and see if there is any problem.
I was using the same exit code for both modes, but only "SecondWindow" could exit correctly. Could you not replicate it on your side? If not it's probably a problem on my environment. What I tried was that it happens on both the debug mode of my dev machine and msix
packaged release version on my laptop.
@AkazaRenn Yes, I can also replicate this bug. Before it's fixed, I suggest adding System.Diagnostics.Process.GetCurrentProcess().Kill();
to ExitApplicationCommand_ExecuteRequested
to terminate the app.