Describe the bug
I'm using NavigationView inside a XboxGameBarWidget settings widget. The first time i open the Settings view with NavigationView, it works fine. However, the second time (or occasionally the problem takes a few more opens to trigger) the I get an exception:
Exception thrown at 0x79B12FF9 (Windows.UI.Xaml.dll) in GhostOverlay.exe: 0xC0000005: Access violation reading location 0x17672284.
That appears to be in NavigationView::MeasureOverride
on the final return __super::MeasureOverride(availableSize);
line.
Steps to reproduce the bug
Steps to reproduce the behavior:
I do not have a reproduction project available right now, as it relies on authentication to a remote API, However my project is on Github https://github.com/joshhunt/GhostOverlay/blob/master/GhostOverlay/WidgetSettingsBountiesView.xaml.cs. WidgetSettingsView
contains the NavigationView, with WidgetSettingsBountiesView
being the first page in the nav.
Expected behavior
I expect it to not crash!!!
Version Info
Windows 10 1909 - Desktop
Microsoft.UI.Xaml 2.3.200213001
@joshhunt can you try using the latest pre-release build ? There have been several updates to NavigationView since the last stable release.
@ranjeshj I installed 2.4.0-prerelease.200322001
from Nuget from within Visual Studio, and i get a load of "Payload file does not exist" errors. The previous prerelease also had the same problem.
These files are indeed not in my filesystem. I downloaded the .nupkg from https://www.nuget.org/packages/Microsoft.UI.Xaml/2.4.0-prerelease.200322001 and looked it in manually and the files were not there either :/
Can you try deleting the output folder, restarting VS and doing a clean build ? If you still hit it, can you share a repro ?
@ranjeshj Yeah, no dice. Here's the repo https://github.com/joshhunt/GhostOverlay
I made a new solution and was able to add the prerelease, so there must be something funky in this solution, but im unsure (I'm quite new to .Net development!)
well.. I am able to build the app without errors. I had to create a packages folder, rename the resw file and restore the nuget packages for it to work. Can you ensure that your nuget packages are restored without any errors ? Perhaps you are hitting issues with nuget restore which is causing other errors down the line.
Thanks for checking that @ranjeshj. I recloned the repo and then i was able to successfully install the prerelease version. Unfortunately, I still experience the same issue, though the breakpoint appears at a different place
If i get a moment I will see if I can create a repro test case that doesnt require the API. Right now, I'm unsure if the issue only occurs when the View is loaded within the Game Bar - I'll try and include that in my testing.
A little more investigation - if I launch the same Page in the main desktop app first, and then open the settings widget in Game Bar, this issue doesnt appear to occur.
I've created a minimal reproduction case that demonstrates the problem for me https://github.com/joshhunt/GhostOverlay/tree/nav-view-reproduction. Note that this is a branch nav-view-reproduction
and not master
.
Please let me know if you have any further questions :)
@joshhunt I'm having trouble getting it to repro/debug. Would it be possible to create a standalone repro without the ghost overlay ?
@ranjeshj from the best i can tell, the issue only occurs when using NavigationView within a widget in the Windows Xbox Game Bar https://docs.microsoft.com/en-us/gaming/game-bar/overview. I have not been able to replicate this issue outside that.
I get reports from users that this issue happens to them as well. Sometimes it takes a few opens to trigger, but I'm able to fairly consistently replicate it.
It appears I've resolved the problem by using the default platform NavigationView rather than the one from the NuGet package.
The NavigationView in MUX has a lot of updates compared to the one in the platform. Once you update to WinUI3, you will get the MUX one as well, so it would be good to not revert back to the one in the platform. If we can figure out what the crash is then it would be helpful.
Most helpful comment
@joshhunt can you try using the latest pre-release build ? There have been several updates to NavigationView since the last stable release.