WinUI 3 app crashes when NavigationViewItem IsSelected="True" and built with WindowsAppSDK 1.2.221109.1 or later #8002
Labels
area-NavigationView
NavView control
bug
Something isn't working
Crash
whenever user reports a crash or app freeze
no-issue-activity
team-Controls
Issue for the Controls team
Describe the bug
I have a WinUI 3 app that used to work fine up until WindowsAppSDK ver. 1.2.220930.4-preview2 but crashes with 'Value does not fall within the expected range.' unhandled exception message when built with newer WindowsAppSDK.
The issue is with preselecting NavigationViewItem via IsSelected property (set to "True") in xaml when NavigationViewItem Content is something different than simple string:
(xaml angle brackets swapped for brackets just to have it displayed correctly here)
[NavigationViewItem.Content]The text[/NavigationViewItem.Content]
works fine,
but:
[NavigationViewItem.Content]
[TextBlock Text="The text"/]
[/NavigationViewItem.Content]
does not.
Steps to reproduce the bug
(actually i think any blank WinUI app will do)
MainPage.zip
Expected behavior
It should be possible to use the NavigationViewItem IsSelected property in xaml without restrictions to the NavigationViewItem Content
Screenshots
No response
NuGet package version
Windows App SDK 1.2.1: 1.2.221116.1
Packaging type
Packaged (MSIX)
Windows version
Windows 10 version 20H2 (19042, October 2020 Update)
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: