BUG and REGRESSION: Custom NavigationViewItem crashes app at startup #8814
Labels
area-NavigationView
NavView control
bug
Something isn't working
closed-Fixed
Described behavior has been fixed.
team-Controls
Issue for the Controls team
Milestone
Describe the bug
Firstly, I have spent considerable time investigating this and pinpointing the cause of this issue. Please don't arbitrarily close this without investigating it.
Between WASDK 1.1.5 and 1.2.221109.1 there is a regression that crashes my app at startup. My
NavigationView
uses customNavigationViewItem
s (calledHomeMenuItem
). Setting theNavigationView
propertySelectedItem
to this at startup will cause the app to crash with a nonsensical errorValue does not fall within the expected range.
in everybodies favourite useless block of code:Interestingly, if the ctor assignment of
SelectedItem
is commented and it's done later (i.e. via a button), it works.To further elucidate on the cause, overriding the
HomeMenuItem
template (i.e. by settingContent="Hello"
) in the XAML stops this bug.The fact that this behaviour occurs during startup is also interesting but works once the app is displayed. It's also clearly a regression given it works in 1.1.5 and earlier (code has been in place since before WASDK).
Please reach out if you need anything further :)
Steps to reproduce the bug
Github repro available here: https://github.com/knightmeister/WinUiNavViewCooked
Change the Nuget WASDK version to 1.1.5 and observe it works. Anything after that (including the latest) does not work.
Expected behavior
App does not crash when using custom
NavigationViewItem
.Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.4.0: 1.4.230822000
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
The text was updated successfully, but these errors were encountered: