microsoft / microsoft/microsoft-ui-xaml

Application crashes when using NavigationView that contains only one NavigationViewItem.

Open
#10,265 1 comment 0 reactions 0 assignees View on GitHub
area-NavigationView bug team-Controls
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### 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.

```
false
None
```

3. Edit MainWindow.xaml

```xml






```

4. Edit MainWindow.cpp to disable template code.

```cpp
void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&)
{
//myButton().Content(box_value(L"Clicked"));
}
```

5. Build and Run. Then make window smaller with mouse.

### Expected behavior

_No response_

### Screenshots

![Image](https://github.com/user-attachments/assets/310999a5-841c-4eff-857f-db71841bf857)

### 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_

Contributor guide

Open the contributing guide

Research direction

Start with the minimal MainWindow.xaml containing one NavigationViewItem, the unpackaged settings in the .vcxproj file, and MainWindow.cpp; build and run the C++ desktop WinUI 3 app, then resize the window. Trace the NavigationView behavior during resizing and compare it with the two-item case. Done means the one-item NavigationView no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.