- 
                Notifications
    
You must be signed in to change notification settings  - Fork 773
 
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-triageIssue needs to be triaged by the area ownersIssue needs to be triaged by the area owners
Description
Describe the bug
As the title: AppWindow.Closing event is not raised when calling Application.Current.Exit()
Why is this important?
Since the event is not fired, it's impossible to track the window or cancel the window closing action with AppWindowClosingEventArgs
Steps to reproduce the bug
- Having this code
 
private void PART_WindowContent_Loaded(object sender, RoutedEventArgs e)
{
    AppWindow.Closing += AppWindow_Closing;
    AppWindow.Destroying += AppWindow_Destroying;
}
private void AppWindow_Closing(AppWindow sender, AppWindowClosingEventArgs e)
{
    // this event is not fired
}
private void AppWindow_Destroying(AppWindow sender, object e)
{
    // this event is fired
}- Call 
Application.Current.Exit()to quit the app while the window is open 
Actual behavior
AppWindow.Closing is not fired
Expected behavior
AppWindow.Closing must be fired
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.8.2: 1.8.251003001
Windows version
Windows 11 (24H2): Build 26100
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-triageIssue needs to be triaged by the area ownersIssue needs to be triaged by the area owners