Crash when theme changes during queued Flyout presentation

Author: jumhyn-browserCreated Sep 29, 2026Updated Sep 30, 2026
Labelsbugteam-Core

Describe the bug

It is possible for a crash to occur when an element's theme changes while it has a queued flyout waiting for presentation after ShowAt while another flyout is still closing.

Why is this important?

WinUI attempts to access the presenter before it has been populated and crashes the app as a result.

Steps to reproduce the bug

Attached code reproduces the issue:

msbuild .\FlyoutThemeRepro.vcxproj /restore /p:Configuration=Debug /p:Platform=x64
.\x64\Debug\FlyoutThemeRepro.exe --auto

It also shows a workaround (append the --prewarm argument to the launch args) where we access IsConstrainedToRootBounds() before ShowAt to force a call to EnsurePopupAndPresenter()

WinUIFlyoutThemeRepro.zip

Actual behavior

App crashes

Expected behavior

App does not crash

Screenshots

No response

NuGet package version

2.3.0

Windows version

Windows 11 (25H2): Build 26200

Additional context

No response

Source: microsoft/microsoft-ui-xaml