-
Couldn't load subscription status.
- Fork 1.4k
Closed
Labels
Completed 🔥bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behaviorcontrols 🎛️hotfix 🌶
Milestone
Description
Describe the bug
Setting InAppNotificationClosingEventArgs.Cancel to true in the InAppNotification.Closing event prevents Dismiss from closing the notification as expected. However, subsequent calls to Dismiss will no longer raise the Closing event.
Steps to Reproduce
- Handle the Closing event to set Cancel to true.
- Set a breakpoint in the event.
- Call Dismiss. The breakpoint will be hit. Continue.
- Call Dismiss again. The breakpoint won't be hit and the notification won't be closed.
Expected behavior
When calling Dismiss again the notification should be closed. The Closing event should be called, too.
Environment
NuGet Package(s): Microsoft.Toolkit.Uwp.UI.Controls
Package Version(s): 7.1.2
Additional context
The bug is in InAppNotification.cs. The implementation of Dismiss(InAppNotificationDismissKind, bool) removes the notification from the stack before raisin the Closing event:
Line 196 in 63cbb4a
| _stackedNotificationOptions.RemoveAt(0); |
So, even if Closing was cancelled, subsequent calls to Dismiss will abort because the stack is empty:
Metadata
Metadata
Assignees
Labels
Completed 🔥bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behaviorcontrols 🎛️hotfix 🌶