-
-
Notifications
You must be signed in to change notification settings - Fork 220
C# Maui.Android Release Mode SIGSEGV #3837
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
Comments
Assigning to @getsentry/support for routing ⏲️ |
Routing to @getsentry/product-owners-issues for triage ⏲️ |
@ReneGreen27 am I misunderstanding, this seems like an SDK issue? |
Possibly related to:
We have a fix for the first in the pipeline. The second one I haven't had a chance to look at yet. |
@gwise-vision we just released version 5.0.0 of the SDK, which includes the fix from #3694. Are you able to update to version 5 to see if that fix is related to the issue you're experiencing? The other thing to check would be that you're not enabling AOT compilation as this isn't yet supported on Android. |
@gwise-vision just following up on this. It looks like this is due to the way the Native SDK for Sentry interacts with the .NET SDK for Sentry. As a workaround, for the time, you can disable the Native SDK when initialising Sentry on Android: #if ANDROID
options.Native.EnableNdk = false;
#endif The default value for |
OK~ |
When will this bug be fixed? |
@gwise-vision this issue is at the top of the backlog. I've been busy digging into a similar problem on iOS over the last couple of weeks (so haven't been able to look into this one on Android yet). It's very odd that you see a SIGSEGV after disabling the NDK. Can you check (on the bug report that you see in Sentry) which SDK reported the bug? If you scroll down underneath the list of Assemblies there should be an SDK section with the name and version of the SDK. It would be strange to see a SIGSEGV reported by the .NET SDK as the runtime should ordinarily capture these and translate them into managed exceptions. |
"environment": "production", |
Thanks @gwise-vision - that's definitely coming from the Native SDK:
We set the name here to distinguish these reports from crashes that are reported by the Native SDK that aren't from Android apps built with .NET:
But that version number definitely corresponds to the NDK. About the only thing I can think that might have happened is that a crash report might have been created before you disabled the NDK and cached on the file system (this happens when an error crashes the application - the idea is that it will be sent on startup next time you run the application)... and then when you ran the app again with the NDK disabled, that old crash report might have been sent. In any event, I'll look into an alternative workaround to this as we'd rather not disable the NDK entirely... it's really good to have it there catching native crashes, more generally. We just don't want it capturing signal errors for exceptions that have already been wrapped and reported as managed exceptions by the .NET SDK. We just made a similar fix for EXC_BAD_ACCESS mach exceptions on iOS by using the BeforeSend hook in the Native SDK so I'll see if we can do something similar on Android... it's more complex on Android since there's another level of indirection (.NET -> Java -> Native), but we'll see. |
@gwise-vision I just started looking into this issue today and I can't reproduce it. I tweaked the Sentry.Samples.Maui project so that the managed crashes are caused by NREs... e.g.: private void OnCapturedExceptionClicked(object sender, EventArgs e)
{
try
{
string s = null;
_logger.LogInformation("The length of the string is {StringLength}", s!.Length);
}
catch (Exception ex)
{
SentrySdk.CaptureException(ex);
}
} Then I'm running this in release mode on a simulator: dotnet build ./samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj /p:_IsPublishing=true -t:Run -c Release -f net9.0-android35.0 But I'm getting plain old managed NullReferenceExceptions being captured and reported to Sentry (no SIGSEGV). I'm wondering if this is something to do with your solution/project configuration. Are you able to share that with me so that I can try to reproduce this?
See this comment. There's an open issue looking into AOT compilation on Android: |
C# maui.android release settings options.
|
Thanks @gwise-vision - it's possibly related to the concurrent garbage collection (seems to be an issue with MAUI itself, rather than Sentry): However, you might also get this if you're using version 5.0.0 of the Sentry SDK. This was the main reason for the 5.0.1 point release. As of today though, you're probably best upgrading to 5.1.0. Are you currently using version 5.0.0 by any chance? |
Current Version : Sentry.Maui --version 5.0.1 |
OK, I'm finally seeing SIGSEGV exceptions. The secret was:
I should be able to suppress these now: |
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
When deploying in release mode in C# Maui.Android, Sentry crashes every time. The Android app does not crash, but only the Sentry log is as follows:
The text was updated successfully, but these errors were encountered: