microsoft / microsoft/WindowsAppSDK

COMException (0x80070490) when subscribing to UserNotificationListener.NotificationChanged in unpackaged WinUI 3 app

Open
#6,172 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area-Notifications needs-triage
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

In an unpackaged, self-contained WinUI application, subscribing to `UserNotificationListener.NotificationChanged` throws a `COMException` with HRESULT `0x80070490 (Element not found)`.

Other `UserNotificationListener` APIs appear to function correctly in the same scenario. Specifically:
- `UserNotificationListener.Current`
- `RequestAccessAsync()` returns Allowed
- `GetNotificationsAsync()` works as expected

However, attempting to register the `NotificationChanged` event consistently fails at runtime.

### Repro project
https://github.com/koiseka/notificationchangedexample-repro

### Steps to reproduce the bug

1. Clone the repro project: https://github.com/koiseka/notificationchangedexample-repro
2. Open `NotificationChangedExample.sln` in Visual Studio
3. Build and run the app (unpackaged, self-contained)
4. App calls `RequestAccessAsync()` → returns `Allowed`
5. Subscribing to `UserNotificationListener.NotificationChanged` throws `COMException (0x80070490)`

### Expected behavior

The NotificationChanged event should either:
- Successfully subscribe and fire when notifications change, **or**
- Fail with a clear, documented error indicating that the API is unsupported for unpackaged apps

### Screenshots

_No response_

### NuGet package version

Windows App SDK 1.8.4: 1.8.260101001

### Packaging type

Unpackaged

### Windows version

Windows 11 version 24H2 (26100, June 2025 Update)

### IDE

Visual Studio 2022

### Additional context

### Failing call
```csharp
listener.NotificationChanged += Listener_NotificationChanged;
```

Throws immediately with:
```
System.Runtime.InteropServices.COMException (0x80070490): Element not found
at ABI.WinRT.Interop.EventSource`1.Subscribe(TDelegate handler)
at Windows.UI.Notifications.Management.UserNotificationListener.add_NotificationChanged(...)
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by opening the linked notificationchangedexample-repro project and NotificationChangedExample.sln in Visual Studio, then reproduce the failure at listener.NotificationChanged += Listener_NotificationChanged. Compare the unpackaged, self-contained setup with the documented UserNotificationListener requirements. Done means the event subscribes successfully, or the unsupported scenario is clearly documented with an actionable error.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.