-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
fix: prevent event duplication when JavaBackgroundThread
crashes occur
#3756
base: main
Are you sure you want to change the base?
Conversation
…avaBackgroundThread crashes from creating duplicated event: one UnhandledException one AppDomain.UnhandledException
…d when getting the value to avoid parsing errors
Since it's on java crashes, I couldn't find a way to add tests |
else | ||
{ | ||
// Prevent JavaBackgroundThread crashes from creating duplicated event: one UnhandledException one AppDomain.UnhandledException | ||
o.BeforeSend = new BeforeSendCallback(((_, _) => null), options, o); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this just tell the Android SDK to discard all exceptions? Are there no circumstances in which we want the Android SDK to catch exceptions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there no circumstances in which we want the Android SDK to catch exceptions?
In this case, they can set an options.Native.EnableBeforeSend
to true. But I can't think of any use case in which they would since the event thrown by dotnet has a more detailed set of info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what about java exceptions that don't come from a JavaBackgroundThread
? This would discard those too right? It's just discarding all and any events that get captured by the Java SDK.
And if the user has set any custom BeforeSend callback, this workaround wouldn't work right???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But what about java exceptions that don't come from a
JavaBackgroundThread
? This would discard those too right? It's just discarding all and any events that get captured by the Java SDK.
All Java exceptions event throws a dotnet event, as far as I can tell.
if the user has set any custom BeforeSend callback, this workaround wouldn't work right???
it would work as long as Native.EnableBeforeSend
is not set to true. if it's set to true, it means they technically want the Java event to appear
@bricefriha how did you test it manually? |
I added an attachment at scope configuration and generated a I was trying to make a device test, but that would crash the entire test, since it's an unhandled exception |
Reported on #3545 , this bug yielded two events when
JavaBackgroundThread
crashes occurred: oneUnhandledException
with no Logcat attachments and no scope attachments and oneAppDomain.UnhandledException
with all expected attachments.This change prevents the
UnhandledException
event to popup.The reason why we are choosing the event with
UnhandledException
mechanism overAppDomain.UnhandledException
is for consistency purposes, as other Java crashes send a singleAppDomain.UnhandledException
event.