getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
604 stars 206 forks source link

fix: prevent event duplication when `JavaBackgroundThread` crashes occur #3756

Open bricefriha opened 2 weeks ago

bricefriha commented 2 weeks ago

Reported on #3545 , this bug yielded two events when JavaBackgroundThread crashes occurred: one UnhandledException with no Logcat attachments and no scope attachments and one AppDomain.UnhandledException with all expected attachments.

This change prevents the UnhandledException event to popup. The reason why we are choosing the event with UnhandledException mechanism over AppDomain.UnhandledException is for consistency purposes, as other Java crashes send a single AppDomain.UnhandledException event.

bricefriha commented 1 week ago

Since it's on java crashes, I couldn't find a way to add tests

jamescrosswell commented 1 week ago

Since it's on java crashes, I couldn't find a way to add tests

@bricefriha how did you test it manually?

bricefriha commented 1 week ago

how did you test it manually?

I added an attachment at scope configuration and generated a JavaBackgroundThread crash and checked Sentry if we have only one event and all the attachments

I was trying to make a device test, but that would crash the entire test, since it's an unhandled exception