Why does SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility cause

Hong 1,186 Reputation points
2023-11-19T23:44:24.86+00:00

SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

The above code worked fine for a UWP app. After I migrated the app to WinUI, it throws:

System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>


Could anyone shed some light on this?

Universal Windows Platform (UWP)
Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
737 questions
0 comments No comments
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 16,146 Reputation points Microsoft Vendor
    2023-11-20T07:48:12.9933333+00:00

    Hi @Hong ,

    Welcome to Microsoft Q&A!

    The class Windows.UI.Core.SystemNavigationManager is not support in WinUI3 project.

    It is recommended that you use Microsoft.UI.Xaml.Controls.NavigationView in your WinUI3 project.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful