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

NavigationView leads to internal crash when close the application

Open SeRgI1982 opened this issue 3 years ago • 4 comments

Describe the bug

I have an app with TabView control. Inside selected tab I have NavigationView with different configuration of other controls. When I close app by X button, my app crash with such Exception

Exception thrown at 0x00007FFFEE0940AC in MyCRM.App.exe: Microsoft C++ exception: winrt::hresult_error at memory location 0x000000A68937D640.

Steps to reproduce the bug

  1. Create App with TabView control

  2. Inside TabViewItem put view like Master-Details where on the Master you have NavigationView

  3. Assign elements to NavigationView.MenuItemsSource and template selector to NavigationView.MenuItemTemplateSelector image

  4. Expand some Menu items

  5. Close the app by X button (right-top corner) Exception happens

image

Expected behavior

The app will be close without exception

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.2.4: 1.2.230217.4

Windows version

Windows 11 (21H2): Build 22000

Additional context

No response

SeRgI1982 avatar Mar 02 '23 10:03 SeRgI1982

Can you share a minimal reproducible example shown in following link? How to create a Minimal, Reproducible Example

sotanakamura avatar Mar 12 '23 04:03 sotanakamura

I can confirm this crash still happens in the latest Win App SDK 1.4.231115000.

It seems to be most easily reproducible by not selecting either of the tabs. Just launch the application and click the window close button. It may not happen on every launch.

A minimal example is as simple as replacing the standard sample XAML content as follows:

	<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
		<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>

		<NavigationView PaneDisplayMode="Top" SelectionFollowsFocus="Enabled" IsBackButtonVisible="Collapsed" IsSettingsVisible="False">
			<NavigationView.MenuItems>
				<NavigationViewItem Content="Tab 1" Tag="Tab1Page" />
				<NavigationViewItem Content="Tab 2" Tag="Tab2Page" />
			</NavigationView.MenuItems>
			<Frame x:Name="contentFrame"/>
		</NavigationView>
	</StackPanel>

StevoSM avatar Nov 24 '23 07:11 StevoSM

@SeRgI1982 Would you be able to provide a min repro of this issue?

@StevoSM I tried your repro several times but am not seeing this exception. Are you seeing the same call stack with your repro?

ojhad avatar Feb 08 '24 23:02 ojhad

@ojhad It appears that the crash only happened when there was no content in the NavigationView. Once I added content, I didn't see the crash anymore.

StevoSM avatar Feb 12 '24 01:02 StevoSM