Skip to content

InAppNotification can no longer be dismissed after canceling the Closing event #4423

@ianier

Description

@ianier

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:


So, even if Closing was cancelled, subsequent calls to Dismiss will abort because the stack is empty:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions