microsoft / microsoft/WindowsAppSDK
`ToastNotificationManager` APIs crash on Window-minimize
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
### Describe the bug
`ToastNotificationManager` APIs crash when being called in the `VisibilityChanged` event handler of `Window` **when the window is being minimized using the `Windows-D` keyboard shortcut**
### Steps to reproduce the bug
```
public MainWindow()
{
InitializeComponent();
VisibilityChanged += (s, e) =>
{
_ = ToastNotificationManager.CreateToastNotifier();
_ = ToastNotificationManager.History.GetHistory();
};
}
```
- Launch app
- Press `Windows-D` keyboard combination to minimize all windows
- Crash with `COMException: 'ClassFactory cannot supply requested class'`
Example project: [test.zip](https://github.com/user-attachments/files/20754557/test.zip)
### Expected behavior
No crash
### NuGet package version
Windows App SDK 1.7.3: 1.7.250606001
### Packaging type
Packaged (MSIX)
### Windows version
Windows 11 version 24H2 (22621, October 2024 Update)
### IDE
Visual Studio 2022
Contributor guide
No contributing guide indexed for this repository
Research direction
Run the attached example project and reproduce the crash by calling ToastNotificationManager.CreateToastNotifier() and ToastNotificationManager.History.GetHistory() from the Window.VisibilityChanged handler while using Windows-D. Start by tracing those APIs during the minimize transition on Windows 11 24H2. Done means the packaged app no longer throws the reported COMException in that scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100