Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Preview 4] AV(Null) in SystemNavigationManager.GetForCurrentView() #4174

Closed
huoyaoyuan opened this issue Feb 12, 2021 · 10 comments
Closed

[Preview 4] AV(Null) in SystemNavigationManager.GetForCurrentView() #4174

huoyaoyuan opened this issue Feb 12, 2021 · 10 comments
Labels
product-winui3 WinUI 3 issues team-Reach Issue for the Reach team version-winui3preview4 WinUI 3 Preview 4 issues

Comments

@huoyaoyuan
Copy link

Describe the bug
Access violation to location 0x00000000. This should be a null pointer exception.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Create a blank WinUI 3 desktop app for Preview 4. Verifies that blank app works.
  2. Install Microsoft.Toolkit.Uwp.UI.Controls 8.0.0-preview4 from their feed.
  3. Add a blank MasterDetailsView to main window.
  4. Exception thrown when the MasterDetailsView is loaded.

Expected behavior
Shows without exception.

Version Info

NuGet package version:

Microsoft.WinUI 3.0.0-preview4.210210.4
Not seeing in preview3 or preview2.

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context
Stack trace:

 	CoreUIComponents.dll!Microsoft::WRL::ComPtr<Windows::UI::Core::ICoreWindow>::As<ICoreWindowInterop>()	未知
 	CoreUIComponents.dll!Windows::UI::Core::SystemNavigationManagerStatics::GetForCurrentView()	未知
 	[托管到本机的转换]	
 	Microsoft.Windows.SDK.NET.dll!ABI.Windows.UI.Core.ISystemNavigationManagerStatics.Windows.UI.Core.ISystemNavigationManagerStatics.GetForCurrentView()	未知
 	Microsoft.Windows.SDK.NET.dll!Windows.UI.Core.SystemNavigationManager.GetForCurrentView()	未知
 	Microsoft.Toolkit.Uwp.UI.Controls.dll!Microsoft.Toolkit.Uwp.UI.Controls.MasterDetailsView.OnLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)	未知

WCTK side may be updated to guard for using it. But WinUI side should gracefully return null or something other than crash with null AV.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 12, 2021
@huoyaoyuan
Copy link
Author

huoyaoyuan commented Feb 12, 2021

For preview 3, the same exception is thrown before window shown, and successes after shown.
For preview 4, the exception is still thrown after window shown.

If the API is not meant to be called in WinUI desktop, please tell WCTK to remove the call to it.

@StephenLPeters StephenLPeters added version-winui3preview4 WinUI 3 Preview 4 issues team-Reach Issue for the Reach team product-winui3 WinUI 3 issues labels Feb 13, 2021
@StephenLPeters
Copy link
Contributor

@Austin-Lamb FYI, @michael-hawker with Winui3 preview 4 GetForCurrentView is no long valid to call on Desktop applications.

@huoyaoyuan
Copy link
Author

Can the API errors more gracefully?

@michael-hawker
Copy link
Collaborator

@StephenLPeters thanks, yeah I thought we had replaced all those already. @azchohfi did we miss this one in the past, or is this a new case for Preview 4 that we didn't catch?

@huoyaoyuan thanks for reporting an issue, we'll take a look. We've been a bit focused on clamping down our main 7.0 release, but we'll be doing a bit more vetting of the WinUI 3 versions of controls in March. We have a lot of controls, and we haven't onboarded everything into our integrated tests yet, and are still working on getting those to run on top of WinUI 3 as well.

@huoyaoyuan
Copy link
Author

This is currently blocking MasterDetailsView totally.

@MikeHillberg
Copy link
Contributor

Can the API errors more gracefully?

Unfortunately I'm not sure if there's anything we can do to make them return null or some such. A way to anticipate it is to check the Window.Current property, which will be null in a Desktop app, which is where the GetForCurrentView APIs won't work.

@mvegaca
Copy link

mvegaca commented Feb 15, 2021

Hello, I'm Martin from Windows Template Studio Team.

I'm updating WinUI Templates to WinUI Preview 4 and I'm also having the same Issue

Exception thrown at 0x67D178BE (CoreUIComponents.dll) in MasterDetailIssueApp.exe: 0xC0000005: Access violation reading location 0x00000000.

Adding minimal repro app.
MasterDetailIssueApp.zip

I hope it helps 👍

@MikeHillberg
Copy link
Contributor

I believe SystemNavigationManager only raises its BackRequested event for UWP apps. So best to just ignore this (don't try to retrieve it) on Desktop.

@azchohfi
Copy link
Contributor

@azchohfi did we miss this one in the past, or is this a new case for Preview 4 that we didn't catch?

New case in preview4, which we missed for this release.

@huoyaoyuan
Copy link
Author

Hello, the same issue is blocking ListDetailView (renamed from MasterDetailsView) again, in WinUI/WAS 1.0.0-preview3. @michael-hawker @Austin-Lamb

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Nov 3, 2021
@krschau krschau removed the needs-triage Issue needs to be triaged by the area owners label Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product-winui3 WinUI 3 issues team-Reach Issue for the Reach team version-winui3preview4 WinUI 3 Preview 4 issues
Projects
None yet
Development

No branches or pull requests

8 participants