microsoft / microsoft/WindowsAppSDK

Badge notifications can be lost when clearing and immediately setting a new badge value

Open
#6,616 0 comments 0 reactions 0 assignees View on GitHub
area-Notifications needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

When a badge is cleared and a new badge is posted immediately afterwards, the new badge may not appear.

## Additional observations

* Reproduced with both `Microsoft.Windows.BadgeNotifications.BadgeNotificationManager` and `Windows.UI.Notifications.BadgeUpdater`.
* Adding a delay of approximately 200 ms between the clear and update operations consistently works.
* A delay of 100 ms is insufficient on the tested system.
* This suggests a possible timing/ordering issue in the underlying badge notification pipeline rather than in a specific API surface.

### Steps to reproduce the bug

``` csharp
var badgeNotificationManager = BadgeNotificationManager.Current;

badgeNotificationManager.SetBadgeAsCount(100); // shows "99+"
badgeNotificationManager.SetBadgeAsCount(0); // clears
badgeNotificationManager.SetBadgeAsCount(99); // expected: 99
// actual: no badge
```

## Workaround
``` csharp
badgeNotificationManager.SetBadgeAsCount(0);
await Task.Delay(200);
badgeNotificationManager.SetBadgeAsCount(99);
```

### Expected behavior

The badge should immediately update from "99+" to "99" without requiring a delay.

### Screenshots

_No response_

### NuGet package version

2.2.0

### Packaging type

Packaged (MSIX)

### Windows version

_No response_

### IDE

Other

### Additional context

* Reproduced with Windows App SDK 2.2.
* OS build: **26200.8655**
* IDE: Visual Studio 2026

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the transition through Microsoft.Windows.BadgeNotifications.BadgeNotificationManager and compare it with Windows.UI.Notifications.BadgeUpdater. Trace the badge notification pipeline to determine why clearing followed immediately by setting 99 can lose the update; done means the badge changes from 99+ to 99 without a delay on the reported Windows App SDK version and OS build.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.