microsoft / microsoft/microsoft-ui-xaml

NavigationView PaneDisplayMode=Auto can crash with 0xc000027b during rapid repeated window resizing

Open
#11,505 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-NavigationView bug team-Controls
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

Describe the bug

A packaged C# WinUI 3 desktop application can crash with an unhandled native XAML/WinRT exception when the window is rapidly resized back and forth between narrow and wide sizes while NavigationView.PaneDisplayMode is set to Auto.

The managed exception is a COMException with HRESULT 0x80004005 and no useful stack trace. The process subsequently exits with code 0xc000027b.

Why is this important?

An application should not terminate when the user resizes its window, even if the resize operation is unusually fast.

The issue appears to be timing-dependent and is unlikely to affect most users during normal operation. However, it can cause complete data loss for unsaved work because the process terminates without allowing the application to recover or shut down normally.

PaneDisplayMode="Auto" is being used to provide the standard responsive NavigationView behavior: an expanded navigation pane on wide windows and a compact navigation experience on narrow windows. Avoiding the crash currently requires replacing the built-in automatic behavior with a fixed display mode and custom responsive logic.

Steps to reproduce the bug
  1. Run an existing packaged C# WinUI 3 desktop application containing a NavigationView.

  2. Configure the NavigationView as follows:

<NavigationView
    IsPaneToggleButtonVisible="True"
    IsPaneOpen="True"
    OpenPaneLength="248"
    CompactPaneLength="52"
    PaneDisplayMode="Auto">

    <NavigationView.MenuItems>
        <NavigationViewItem
            Icon="Home"
            Content="Home"
            Tag="Home" />
    </NavigationView.MenuItems>

    <Frame />
</NavigationView>
  1. Start the application.

  2. Rapidly resize the window back and forth between a very narrow and a wide size.

  3. Repeatedly cross the widths at which NavigationView automatically changes its pane display state.

  4. After several rapid transitions, the application terminates with an unhandled native XAML/WinRT exception.

The issue is timing-dependent. Slowly resizing the window does not necessarily reproduce it. Rapidly alternating between narrow and wide sizes makes the crash reproducible.

A standalone minimal reproduction project has not yet been created. The behavior was isolated in an existing application.

Actual behavior

The application raises an unhandled native XAML/WinRT exception:

System.Runtime.InteropServices.COMException (0x80004005): Unspecified error

Visual Studio eventually stops in the generated XAML unhandled-exception handler. The exception does not contain a useful managed stack trace.

The process then terminates with the following exit code:

3221226107 (0xc000027b)
Expected behavior

NavigationView should safely transition between its automatic pane display states while the window is resized.

Rapid or repeated window resizing should not raise an unhandled exception or terminate the application.

Screenshots

No response

NuGet package version

Microsoft.WindowsAppSDK 2.3.1

Windows version

Windows 11 (25H2): Build 26200

Additional context

The crash remains reproducible after upgrading from Windows App SDK 1.8.251106002 to 2.3.1.

Project information:

  • Target framework: net10.0-windows10.0.19041.0
  • Application type: C# WinUI 3 desktop
  • Deployment: packaged/MSIX
  • Architecture: x64
PaneDisplayMode="LeftCompact"

A manual responsive workaround that keeps PaneDisplayMode="LeftCompact" and changes only IsPaneOpen based on the window width also does not reproduce the crash.

The generated debug handler is where Visual Studio eventually stops:

#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
    if (global::System.Diagnostics.Debugger.IsAttached)
        global::System.Diagnostics.Debugger.Break();
};
#endif

Enabling break-on-thrown for System.Runtime.InteropServices.COMException does not expose an earlier managed source location.

The 0xc000027b process exit indicates a stowed exception. No useful managed stack trace is available.

A standalone minimal reproduction project has not yet been created. The behavior was isolated in an existing application.

Contributor guide

Open the contributing guide

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 reproducing the rapid narrow-to-wide resizing with NavigationView.PaneDisplayMode set to Auto in a packaged C# WinUI 3 application. The report names no repository file or test and notes that a standalone minimal reproduction is missing; done means identifying a reproducible failure path and confirming that repeated transitions no longer raise the unhandled exception or exit with 0xc000027b.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.