You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Crash on second window close when SnackBar enabled on Windows (still reproducible in v12.0.0) #2754
A .NET MAUI app using multiple windows and enabling snackbar notifications for Windows via: builder.UseMauiApp<App>().UseMauiCommunityToolkit(options => options.SetShouldEnableSnackbarOnWindows(true));
On the second window close (i.e., after opening, closing, reopening, and then closing the secondary window), the app crashes with an unhandled exception:
Element not found.
Not Registered for App Notifications!
and this stack trace:
at WinRT.ExceptionHelpers.g__Throw|38_0(Int32 hr)
at ABI.Microsoft.Windows.AppNotifications.IAppNotificationManagerMethods.Unregister(IObjectReference _obj)
at Microsoft.Windows.AppNotifications.AppNotificationManager.Unregister()
at CommunityToolkit.Maui.Options.<>c.b__22_4(Window _, WindowEventArgs ) in //src/CommunityToolkit.Maui/Options.cs:line 93
at Microsoft.Maui.MauiWinUIWindow.<>c__DisplayClass10_0.b__0(OnClosed del)
at Microsoft.Maui.LifecycleEvents.LifecycleEventServiceExtensions.InvokeLifecycleEvents[TDelegate](IServiceProvider services, Action`1 action)
at Microsoft.Maui.MauiWinUIWindow.OnClosed(Object sender, WindowEventArgs args)
at Microsoft.Maui.MauiWinUIWindow.OnClosedPrivate(Object sender, WindowEventArgs args)
at WinRT.EventSource_global__Windows_Foundation_TypedEventHandler_object__global__Microsoft_UI_Xaml_WindowEventArgs.EventState.b__1_0(Object sender, WindowEventArgs args)
at WinRT.GenericTypeInstantiations.Windows_Foundation_TypedEventHandler_2_object__Microsoft_UI_Xaml_WindowEventArgs.Do_Abi_Invoke(IntPtr thisPtr, IntPtr sender, IntPtr args)
Expected Behavior
The second window should open and close repeatedly without throwing an exception.
Steps To Reproduce
Create a MAUI app and enable Windows Snackbar in MauiProgram.cs (or use the sample project linked to this ticket).
Launch the app.
Open the secondary window (via the “Click me” button in the sample).
Close that window.
Reopen the secondary window.
Close it again - and observe the crash on the second close.
Activity
ne0rrmatrix commentedon Jun 20, 2025
I can verify this bug is still present. I am working on a PR to fix this. It should be ready in a few hours.