Microsoft-ui-xaml: NavigationView inside ContentDialog causes crash in WinUI3 Desktop

Created on 19 Jun 2020  ·  4Comments  ·  Source: microsoft/microsoft-ui-xaml

Describe the bug

The NavigationView inside the ContentDialog causes the application to crash.

We have the NavigationView inside the ContentDialog working in UWP.

When moved over to WinUI3 Desktop, the application crashes before the NavigationView can load.

Steps to reproduce the bug

  1. Clone the WinUI3 Problems DialogWithNavView repository.
  2. Go to the DialogWithNavViewWinUI folder.
  3. Open the DialogWithNavViewWinUI solution in Visual Studio 2019 Preview.
  4. Build and run with Debug x64.
  5. Click the "Click me" button.
  6. You should see that the ContentDialog does not appear, and the application crashes with an error. See Screenshot#1.

Expected behavior

After clicking on the "Click me" button, we expect to see the NavigationView inside the ContentDialog. See Screenshot#2 below for expected behavior.

We expect to see the same behavior we saw in UWP. Build and run the DialogWithNavViewUWP solution inside the DialogWithNavViewUWP folder to see expected behavior.

Screenshots

DialogWithNavViewErrorMessage

Screenshot#1 - Current Behavior (Error Message)

DialogWithNavViewExpectedBehavior

Screenshot#2 - Expected Behavior

Version Info

NuGet package version:
[Microsoft.VCRTForwarders.140 1.0.6]
[Microsoft.WinUI 3.0.0-preview1.200515.3]

Targeting:
Target: Universal Windows
Target version: Windows 10, version 1809 (10.0; Build 17763)
Min version: Windows 10, version 1809 (10.0; Build 17763)

| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| November 2019 Update (18363) | |
| May 2019 Update (18362) | |
| October 2018 Update (17763) | Yes |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |

| Device form factor | Saw the problem? |
| :-------------------- | :------------------- |
| Desktop | Yes |
| Mobile | |
| Xbox | |
| Surface Hub | |
| IoT | |

Additional context

If the NavigationView is removed or commented out, the application does not crash and the ContentDialog is displayed (without NavigationView).

To demonstrate this, comment out line numbers 16 - 22 in DialogWithNavView.xaml.

Area-Desktop area-Dialogs area-NavigationView team-Controls winui3preview

Most helpful comment

I'm curious why you are putting a NavView in a Content Dialog :) seems like a valid bug but a strange use case.

All 4 comments

I'm curious why you are putting a NavView in a Content Dialog :) seems like a valid bug but a strange use case.

Hi @StephenLPeters ! We host our settings interface inside of the NavView inside the ContentDialog.

@eleanorleffler Can you try setting IsPaneOpen="False" on the NavigationView as a workaround? That hopefully should unblock you for now

@ojhad The workaround unblocks us! Thank you for the workaround!

Was this page helpful?
0 / 5 - 0 ratings