maui icon indicating copy to clipboard operation
maui copied to clipboard

Unhandled Win32 Exception when Calling Shell.GoToAsync(..) during a load of a page

Open GasimoCodes opened this issue 2 years ago • 7 comments

Description: An unhandled win32 exception appears when calling Shell.Current.GoToAsync("//PageName"); before Shell PageView finishes loading. Calling after the page is loaded (ie. using an callback after page loads) executes as expected without any issues.

Edit: Added repro repo: https://github.com/GasimoDoesCode/MauiIssueRepro

Discussed in https://github.com/dotnet/maui/discussions/8462

Originally posted by mehmetilker July 1, 2022 Sometimes I am seeing following exception and neither can see details or catch the exception in code.

Sometimes it happend when I close the app. For example what I am doing a rediction to xaml page from razor page with following way:

    async void GoToCategory()
    {
        try
        {
            await Shell.Current.GoToAsync("//category/world?CategoryId=world",
                      new Dictionary<string, object>
                          {
                              ["bear"] = "aaa"
                          });
        }
        catch(Exception ex)
        {
            Debug.WriteLine(ex.ToString());
        }      
    }

Is there a way to see details of this kind of exceptions?

image

GasimoCodes avatar Dec 12 '22 20:12 GasimoCodes

Try to push latest changes to github, then pull the project to another folder and run in debug.

8m0 avatar Dec 13 '22 10:12 8m0

Try to push latest changes to github, then pull the project to another folder and run in debug.

Hi @8m0, this unhandled win32 exception appears even in a brand new MAUI Sample project (Appearing on MAUI 6 using VS 17.4.2 and 17.5) which is not linked to any git repo.

GasimoCodes avatar Dec 13 '22 14:12 GasimoCodes

Hi @GasimoDoesCode. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Dec 13 '22 19:12 ghost

Added repro repo: https://github.com/GasimoDoesCode/MauiIssueRepro

GasimoCodes avatar Dec 13 '22 21:12 GasimoCodes

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

ghost avatar Feb 20 '23 15:02 ghost

Verified this on Visual Studio Enterprise 17.7.0 Preview 1.0. Repro on Windows 11 with below Project: MauiIssueRepro.zip

XamlTest avatar Jun 12 '23 06:06 XamlTest

This is still an issue on Windows but it doesn't always happen. Looks like a race condition under the hood somewhere.

DenisSikic avatar Jan 03 '24 18:01 DenisSikic

Hey team, any idea how we could trap these unhandled win32 exceptions so the impact can be measured in production with tools like Sentry.io etc.

smacpherson-ces avatar Mar 21 '24 05:03 smacpherson-ces

This issue still exists in MAUI 8.0.40

twojnarowski avatar May 19 '24 18:05 twojnarowski