microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Window & app require two clicks to close

Open tipa opened this issue 7 months ago • 1 comments

Describe the bug

I wondered why I had to click twice on the windows "close" button for the window to close and my app to shut down. I was able to narrow it down to the code below. It looks like it's caused by a x:Load="False" element in my NavigationView

Steps to reproduce the bug

Download and run this example project: test.zip

It essentially just contains this in the Window:

<Window
    x:Class="test.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <NavigationView>
        <NavigationView.MenuItems>
            <NavigationViewItem>
                <TextBlock x:Name="myTextBlock" x:Load="False" />
            </NavigationViewItem>
        </NavigationView.MenuItems>
    </NavigationView>
</Window>

Expected behavior

App & Window closes on first click on the window close button

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.8 Experimental 1: 1.8.250515001-experimental2

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

tipa avatar May 28 '25 13:05 tipa

As it returns an error (E_POINTER apparently at https://github.com/microsoft/microsoft-ui-xaml/blob/d37afef65a0fc3219ba6b349301d685099fb129d/src/dxaml/xcp/dxaml/lib/DependencyObject.cpp#L1424 called from https://github.com/microsoft/microsoft-ui-xaml/blob/d37afef65a0fc3219ba6b349301d685099fb129d/src/dxaml/xcp/dxaml/lib/DesktopWindowImpl.cpp#L461) it does not close the window the fist time

castorix avatar May 28 '25 15:05 castorix