Closed akravch closed 1 month ago
Hey @akravch, sorry to see you run into issues. Based on your description it sounds like it should be fairly straight forward to reproduce the issue but I fail to do so locally. The FormatException
happens during the restart?
Hi @bitsandfoxes, thanks for the quick reply!
Yeah, the exception is thrown during the restart, I guess when the SDK is deserializing the context to make it available in the BeforeSend
callback.
Now as you said you couldn't reproduce it locally I went back and tried it again myself, and in my sample I can reproduce it reliably when I crash the app, and then start it with debugger attached. However, in our "big" real app it reproduces simply crashing and restarting, regardless of the debugger, even on the apk built by a remote build agent, so it doesn't look related to my local setup either.
Could it be related to the slower startup time for the real app compared to the sample, and the debugger adding up some time for the sample and making it reproducible?
I have uploaded the sample here just in case, although it's basically a dotnet new android
+ a few lines for Sentry.
Thanks for the sample. I'll give that a try and see what happens!
Ahh, now I got it! For some reason that one was tricky to repro. The exception gets swallowed in release builds? And the debugger refused to connect to the actual device most of the times. But I found the bugger, a fix is on its way. Thanks again for reaching out!
That's great, thanks for such a quick fix!
Package
Sentry
.NET Flavor
.NET
.NET Version
8.0.6
OS
Android
SDK Version
4.8.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
Sentry
NuGet packageConfigure Sentry so that
EnableBeforeSend
is enabled andBeforeSend
callback is set to something:SentrySdk.CauseCrash(CrashType.Native)
Expected Result
BeforeSend
callback is fired, the crash is sent, the app works normally.Actual Result
Crash with the following stack trace:
The reason is that the
battery_level
field is saved with a floating point, but the SDK expectsshort
during deserialization: