You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, in one of the most recent updates this issue was resolved by merging OnCrashLastRun for iOS C# implementation #3958.
However, when setting up SentrySdk in MAUI options.CrashedLastRun is always null for Android, even if its a startup after a cash. Is it possible to add OnCrashLastRun for Android MAUI as well, or maybe we are not using options.CrashedLastRun correctly. There are no Samples on how to detect the result of the Func.
I'm not aware of that functionality. As far as I know any event from a previous run is sent to Sentry without going through public callbacks (EnvelopeSender -> Scopes.captureEnvelope -> SentryClient.captureEnvelope.
There is an internal callback it should go through (beforeEnvelopeCallback) but that is used for Spotlight.
Maybe @markushi knows a different way and/or can confirm this.
On Android a crash is usually reported and sent to sentry right after it is detected. Thus the crash event is not available anymore on the next app run. You should still be able to use hooks like beforeSend on Android, but based on the above they will be executed right after the crash occured.
While initiating Sentry for MAUI the options.CrashedLastRun is always null. Maybe the following line is run later? options.CrashedLastRun = () => JavaSdk.Sentry.IsCrashedLastRun()?.BooleanValue() is true;
I know iOS implementation has the feature added to the sample, could the android sample also be updated to expose how CrashedLatRun should be interpreted in the consumer code?
could the android sample also be updated to expose how CrashedLatRun should be interpreted in the consumer code?
@dalux-era that sounds like a good idea. I've added #4048 to track this.
While initiating Sentry for MAUI the options.CrashedLastRun is always null. Maybe the following line is run later?
options.CrashedLastRun = () => JavaSdk.Sentry.IsCrashedLastRun()?.BooleanValue() is true;
Yes, this gets wired up in the call to InitSentryAndroidSdk, which occurs part way through initialising the Sentry SDK. You won't be able to rely on getting a value back from this until after the SDK has been initialised.
Activity
jamescrosswell commentedon Mar 18, 2025
It looks like we're exposing whether a crash occurred or not:
sentry-dotnet/src/Sentry/Platforms/Android/SentrySdk.cs
Line 169 in 1f56e7e
However there's not yet any callback where you can see what the event was.
@adinauer does that functionality exist in the Java SDK?
adinauer commentedon Mar 19, 2025
I'm not aware of that functionality. As far as I know any event from a previous run is sent to Sentry without going through public callbacks (
EnvelopeSender->Scopes.captureEnvelope->SentryClient.captureEnvelope.There is an internal callback it should go through (
beforeEnvelopeCallback) but that is used for Spotlight.Maybe @markushi knows a different way and/or can confirm this.
markushi commentedon Mar 19, 2025
On Android a crash is usually reported and sent to sentry right after it is detected. Thus the crash event is not available anymore on the next app run. You should still be able to use hooks like
beforeSendon Android, but based on the above they will be executed right after the crash occured.dalux-era commentedon Mar 19, 2025
While initiating Sentry for MAUI the options.CrashedLastRun is always null. Maybe the following line is run later?
options.CrashedLastRun = () => JavaSdk.Sentry.IsCrashedLastRun()?.BooleanValue() is true;I know iOS implementation has the feature added to the sample, could the android sample also be updated to expose how CrashedLatRun should be interpreted in the consumer code?
jamescrosswell commentedon Mar 19, 2025
@dalux-era that sounds like a good idea. I've added #4048 to track this.
Yes, this gets wired up in the call to
InitSentryAndroidSdk, which occurs part way through initialising the Sentry SDK. You won't be able to rely on getting a value back from this until after the SDK has been initialised.jamescrosswell commentedon Mar 28, 2025
Closing this issue in favour of: