Skip to content

Application crashes when using NavigationView that contains only one NavigationViewItem. #10265

@ynkdir

Description

@ynkdir

Describe the bug

Application crashes when using NavigationView that contains only one NavigationViewItem.

Steps to reproduce the bug

  1. Create new c++ desktop winui3 project.

  2. Edit .vcxproj file to build unpackaged app.

    <AppxPackage>false</AppxPackage>
    <WindowsPackageType>None</WindowsPackageType>
  1. Edit MainWindow.xaml
<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="navviewtest.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:navviewtest"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Title="navviewtest">

    <NavigationView>
        <NavigationView.MenuItems>
            <NavigationViewItem Content="Item1" />
            <!--
            App doesn't crash when there are two items.
            <NavigationViewItem Content="Item2" />
            -->
        </NavigationView.MenuItems>
    </NavigationView>

</Window>
  1. Edit MainWindow.cpp to disable template code.
    void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
    {
        //myButton().Content(box_value(L"Clicked"));
    }
  1. Build and Run. Then make window smaller with mouse.

Expected behavior

No response

Screenshots

Image

NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

Windows version

Windows 11 (24H2): Build 26100

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageIssue needs to be triaged by the area owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions