-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
[Net 9][Android] Runtime crash on Sentry.SentrySdk.Init #4030
Comments
Hi @AmaruTrai, thanks for raising this! There seem to be a few things going on. Could you provide us with a small repro for us to run locally? |
we init the Android sdk via the C# sdk. I don't think we supporting adding dan to the android manifest. |
Same problem here after upgrading from "5.2.0" to "5.3.0" in release mode with Partial Trimming and AOT. Revert to "5.2.0" fix the problem. In debug everything works fine. Exception from play store
Configuration of release mode :
MauiProgram : builder.UseSentry(options =>
{
// The DSN is the only required setting.
options.Dsn = "***";
// Use debug mode if you want to see what the SDK is doing.
// Debug messages are written to stdout with Console.Writeline,
// and are viewable in your IDE's debug console or with 'adb logcat', etc.
// This option is not recommended when deploying your application.
#if DEBUG
options.Debug = true;
#endif
// Set TracesSampleRate to 1.0 to capture 100% of transactions for tracing.
// We recommend adjusting this value in production.
options.TracesSampleRate = 1.0;
}); |
I built a .NET 8 app and upgraded this from 5.2.0 to 5.3.0 without any issue. I also tried applying the properties you suggsted @maximebono: <PropertyGroup>
<RunAOTCompilation>True</RunAOTCompilation>
<PublishTrimmed>True</PublishTrimmed>
<TrimMode>partial</TrimMode>
<AndroidEnableSGenConcurrent>True</AndroidEnableSGenConcurrent>
</PropertyGroup> I don't think there's an issue with the SDK then. I suspect there's something else going on. If you set |
Hi @jamescrosswell Release - with project settings default by MAUI template Workloads:
Sentry setup:
Started happening after trying to upgrade from 5.1.0 - which is the current stable version for me right now Running DEBUG mode there is no issue, only in release, deployed to a physical device /haven't tried to an emulator) Today I tried to upgreade to your latest 5.4.0 but the issue remains Here is the log ( I cannot share my project, but I would imagine a simple .net maui app with the same basic configs will behave the same?)
|
Hi @bcaceiro
If you're able to reproduce this in a simple .NET MAUI app that would be a great help. I wasn't able to reproduce this myself though. |
any updates? how safe to use Sentry > 5.1.0 on Android? |
@FoggyFinder We aren't able to reproduce this. We really need a full reproducible sample to see what may be going on. |
@jamescrosswell I've reproduce the crash by adding CommunityToolkit packages :
Hope this help |
@maximebono I have apps being released to production with Sentry 5.4.0 and both communitytoolkits without this issue. I tried your theory that you noted, but that does not crash with the issue. To anyone that is in this thread, please post a reproducible & complete sample on github. We can't guess as to what the issue is. If you are providing additional and new information, please also include the following:
|
I have the same problem with the sdk 5.5.0. I tried to add the dependent libraries mentioned in this pull request #4079 and the app started to run <!-- Dependencies for AndroidMavenLibrary references -->
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.8.7.2" />
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common.Java8" Version="2.8.7.2" />
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.15.0.2" />
`
|
@NiSHoW that's good news (in a way). I mean, it's not great news that the app is currently crashing but it's go we know how to fix it (and that we have a workaround for the time being). |
@jamescrosswell I spoke too soon. Note that I added this to androidmanifest <meta-data android:name="io.sentry.auto-init" android:value="false" />
<meta-data android:name="io.sentry.dsn" android:value="dsnstring" /> here is the new exception taken from the logcat
|
@NiSHoW the error you're seeing in the dashboard might be getting captured by the .NET SDK. This would be indicated by the SDK Name and Version in the issue details - e.g. From the stack trace, it looks like it's crashing here:
My guess is that the <meta-data android:name="io.sentry.auto-init" android:value="false" />
<meta-data android:name="io.sentry.dsn" android:value="dsnstring" /> Both of those things should get propagated to the Android SDK from the .NET SDK so it shouldn't be necessary to put them in the manifest. |
@jamescrosswell I tried removing the sentry metadata from the manifest but the error on 32bit devices persists and returns to "DSN is required" <PropertyGroup Condition="$(TargetFramework.Contains('-android'))">
<RuntimeIdentifiers>android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers>
</PropertyGroup> PS: downgrading to 4.13.0 works I attach the catalog
|
Ah, I see... 32 bit. Sorry I didn't catch that earlier. I think that we should create a new issue for that as it's likely a different cause than the error @AmaruTrai initially reported. |
Package
Sentry
.NET Flavor
.NET
.NET Version
9.0.0
OS
Android
SDK Version
5.3.0
Self-Hosted Sentry Version
No response
Steps to Reproduce
After update sentry sdk from version "5.2.0" to "5.3.0" app start crash with runtime error.
Exception log from logcat:
If setup DSN in Android.xml or setup enable/init options, crash log change to:
Project setting for release version:
Sentry init:
Expected Result
No runtime crash
Actual Result
Crash on runtime.
The text was updated successfully, but these errors were encountered: