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

Migrating from BackRequested UWP to WinUI-3 #9975

Open
vsfeedback opened this issue Sep 11, 2024 · 0 comments
Open

Migrating from BackRequested UWP to WinUI-3 #9975

vsfeedback opened this issue Sep 11, 2024 · 0 comments
Labels
area-Navigation Frame, Page team-Controls Issue for the Controls team

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
In a UWP project (intended for PCs and tablets) I implemented a BackRequested, so that tablets can launch the 'back to previous page action' with the default button offered by tablets, via the following code: In the Page.xaml code of my page there is no change made. In the Page.xams.cs code:

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
    Windows.UI.Core.SystemNavigationManager.GetForCurrentView(). BackRequested += BackRequested;
    
...
}         

private static async void BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
{
    e.Handled = true;

//  code for Back action
}

This UWP code works great! I am migrating this code to WinUI-3. If the previous code compiles very well under WinUI-3, when running, there is a crash at the line:

Windows.UI.Core.SystemNavigationManager.GetForCurrentView(). BackRequested += BackRequested;

The error message:

An unhandled exception of type 'System.AccessViolationException' occurred in Microsoft.Windows.SDK.NET.dll Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Is it possible to migrate this UWP code to WinUI-3, by making the minimum of modifications and especially without touching the Xaml code (because I have 4403 *.xaml files)!

Thanks in advance


Original Comments

Feedback Bot on 9/1/2024, 06:40 PM:

(private comment, text removed)

Ann Yang [MSFT] on 9/1/2024, 11:30 PM:

(private comment, text removed)

COM-ADD on 9/2/2024, 00:37 AM:

(private comment, text removed)

Feedback Bot on 9/2/2024, 01:07 AM:

(private comment, text removed)


Original Solutions

(no solutions)

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Sep 11, 2024
@codendone codendone added area-Navigation Frame, Page team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Navigation Frame, Page team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants