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

AppCenter does not send crash reports on Windows with MAUI packaged app #1688

Closed
rogerbriggen opened this issue Oct 10, 2022 · 11 comments
Closed

Comments

@rogerbriggen
Copy link

Description

I am using preview 1 of the sdk for MAUI. I don't get any crash reports even so they are enabled. If I throw an exception (or use Crashes.GenerateTestCrash()). My app gets closed but nothing is sent to the appcenter, also not after a restart of the app.
This worked with the 4.5.1 SDK

Repro Steps

  • Build an packaged MAUI app (so it is an UWP app and which is currently the default) on Windows and enable appcenter crash module.
  • Trigger an exception -> nothing ends on the appcenter

Details

  1. What is your app platform (Xamarin.Android or Xamarin.iOS or UWP)?
    • MAUI Android, iOS, Windows but this report is about Maui packaged apps on Windows
  2. If using Xamarin.Forms or if using portable/shared code to call our SDK APIs, are you using shared project, PCL code or .NET standard code for the application? Which .NET standard version or which PCL profile?

  3. Which SDK version are you using?
    • 5.0.0 Preview 1
  4. Which OS version did you experience the issue on?
    • iOS Simulator with ios 15.4
  5. What device version did you see this error on? Were you using an emulator or a physical device?
    • iPhone 13 mini Sim, iPhone 13 mini real device
  6. What third party libraries are you using?
    • Automapper, Autofac, ...
  7. Please enable verbose logging for your app using AppCenter.LogLevel = LogLevel.Verbose before your call to AppCenter.Start(...) and include the logs here:
    • How do I get the logs from an UWP app with your logging?
@DmitriyKirakosyan
Copy link
Contributor

Hi @rogerbriggen ,

How do I get the logs from an UWP app with your logging?

You can observe logs in Output panel when running the app using Visual Studio. Please attach logs with AppCenter.LogLevel = LogLevel.Verbose, before and after the crash.

@rogerbriggen
Copy link
Author

rogerbriggen commented Oct 11, 2022

Hi @DmitriyKirakosyan
Thanks for your support. Unfortunately this only works with debugger attached.
Here are the logs:
appcenter_maui_windows_debugger.zip

@DmitriyKirakosyan
Copy link
Contributor

Hi @rogerbriggen , for some reason I don't see any exception call stack in your first log.
May I see the code snipped how you throw an exception? Demo app would be also great, if possible.

@rogerbriggen
Copy link
Author

rogerbriggen commented Oct 13, 2022

Hi @DmitriyKirakosyan
That is because the debugger jumps in... but without debugger there is no output in debug window... and since MAUI does not open a console window, I don't see any output.

I can try to create an app, the current app I cannot share.
What I do is in a ViewModel a command is executed which has a binding to a button and the Command looks like that:
private async Task SendPingAsync()
{
PingResponse = "Waiting for answer...";
await _pingController.SendPingAsync();
throw new NotImplementedException("appcenter test");
}

And after the Exception the Debugger jumps in because of unhandled exception

@rogerbriggen
Copy link
Author

Hi @DmitriyKirakosyan
I just created an empty project with a minimal implementation and there it works... so I will try to see what differences I have in my real project...

@rogerbriggen
Copy link
Author

Hi @DmitriyKirakosyan ,
Alright, I could reproduce the problem. As soon as I have the exception in an async function, it's not workig anymore.
I created a repro app: https://github.com/rogerbriggen/app_center_dotnet_maui , also read README.md

If the function is not async, the report is sent to appcenter but no callstack is available in app center... should I add another report for this?

@DmitriyKirakosyan
Copy link
Contributor

No need to create a separate issue. So the report sent in both cases, right? But if it was inside an async function, it doesn't contain a call stack?

@rogerbriggen
Copy link
Author

@DmitriyKirakosyan
No, it is:

  1. async: nothing is sent to app center (or at least nothing is visible in app center) -> that is why I opened this ticket
  2. sync: an entry is created in app center and attachments are uploaded but the callstack is always empty

@DmitriyKirakosyan
Copy link
Contributor

Got it, thank you. Sorry for the confusion. Marking as a bug.

@DmitriyKirakosyan
Copy link
Contributor

DmitriyKirakosyan commented Oct 31, 2022

Hi @rogerbriggen , it appears that this is a WinUI 3 (used in MAUI) bug, that an exception from an async method is not caught using CoreApplication.UnhandledErrorDetected. See microsoft/microsoft-ui-xaml#5221.
I couldn't find any workaround to be able to catch a crash from async method, but if you know some, please share. Contribution is also very welcome.

As for the point 2., the call stack is empty on portal, even thought it is present in the log when it is sending from SDK. We will work on this bug and let you know on any updates.

@DmitriyKirakosyan
Copy link
Contributor

@rogerbriggen Looks like the error catching in async environment is fixed by the win app sdk team. See microsoft/microsoft-ui-xaml#5221 (comment). So updating WASDK to version 1.2.221209.1 (or greater) should fix the issue.

I'm going to close this ticket as not an SDK issue.

As for

sync: an entry is created in app center and attachments are uploaded but the callstack is always empty

There is a dedicated recently opened issue #1724.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants