Skip to content

Crash on Windows when closing a .NET MAUI modal page using — Win32 exception 0xc000027b in Microsoft.ui.xaml.dll #10897

Description

@sybaris

Describe the bug

Summary

In a .NET MAUI application running on Windows (WinUI 3), closing a modal page using Navigation.PopModalAsync() causes a fatal Win32 exception.
This happens only on Windows — Android works without any issue.

The exception is thrown after clicking a Cancel button on a modal dialog page.
The crash occurs inside Microsoft.ui.xaml.dll, not in user code.

I have reproduced the issue in a minimal project, attached here.

Environment
Platform: Windows 11 (25H2 build 26200.7171)
.NET MAUI: .NET 8
Windows App SDK: Microsoft.WindowsAppRuntime 1.5.5
WinUI: Microsoft.UI.Xaml 3.1.5.0
Architecture: win10-x64 AppX
Crash only occurs on Windows (Android works correctly)

Why is this important?

My apps crashs

Steps to reproduce the bug

  1. Open the sample project.
  2. Run the app on Windows.
  3. Open the modal page (By clicking the rigth top button ).
  4. Click the Cancel button
  5. The application closes immediately with a Win32 exception. (Visual Studio can trap this exception)

Actual behavior

Apps crash

Expected behavior

No crash

Screenshots

Image

NuGet package version

None

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

Metadata

Metadata

Labels

.NET MAUIBugs related to WinUI usage within .NET MAUIbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions