Skip to content

On .NET 9, Java exception on background thread double reports #4237

@bruno-garcia

Description

@bruno-garcia

SDK version 5.9.0 (latest)

Image

Originally, when we, added this method, it was only captured via the native Android SDK.
It seems at some point .NET started also capturing it.

But it's quite odd, because the one captured by .NET has no stack trace (so rather useless)
And the screenshot seems to be sometime after the native one (not sure how many frames)

Managed details

Image

{"event_id":"287cd4d5a475427db838fd4c4c074015","project":5953206,"release":"io.sentry.symbolcollector.android@1.23.0+1","dist":"1","platform":"csharp","message":"","datetime":"2025-06-01T02:20:13+00:00","tags":[["build-type","release"],["device","Pixel 5"],["device.family","Pixel"],["environment","production"],["handled","no"],["level","error"],["mechanism","AppDomain.UnhandledException"],["os","Android 13"],["os.name","Android"],["os.rooted","no"],["runtime",".NET 9.0.4"],["runtime.name",".NET"],["dist","1"],["release","io.sentry.symbolcollector.android@1.23.0+1"],["user","id:40358816-2ec3-4509-8bf7-010aa72c21fa"],["server-endpoint","https://symbol-collector.services.sentry.io/"],["server_name","localhost"],["user-agent","Dalvik/2.1.0 (Linux; U; Android 13; Pixel 5 Build/TQ3A.230901.001)"]],"_dsc":{"environment":"production","public_key":"656e2e78d37d4511a4ea2cb3602e7a65","release":"io.sentry.symbolcollector.android@1.23.0+1","replay_id":null,"trace_id":"7271fcf62c6e47cfb7bc3e2bb3a17cd8","transaction":null},"_meta":{"extra":{"Metrics":{"FileOrDirectoryUnauthorizedAccessCount":{"":{"rem":[["@password:filter","x"]]}}}}},"_metrics":{"bytes.ingested.event":7272,"bytes.ingested.event.attachment":397321,"bytes.stored.event":8554,"bytes.stored.event.attachment":397321},"breadcrumbs":{"values":[{"timestamp":1748744412.191,"type":"default","category":"ui.event","level":"info","message":"OnUploadButtonOnClick"}]},"contexts":{"Current Culture":{"calendar":"GregorianCalendar","display_name":"English (United Kingdom)","name":"en-GB","type":"Current Culture"},"Dynamic Code":{"Compiled":true,"Supported":true,"type":"Dynamic Code"},"Memory Info":{"allocated_bytes":245368,"compacted":false,"concurrent":false,"finalization_pending_count":0,"high_memory_load_threshold_bytes":34501017,"pause_durations":[0,0],"total_available_memory_bytes":38334464,"type":"Memory Info"},"ThreadPool Info":{"available_completion_port_threads":1000,"available_worker_threads":32767,"max_completion_port_threads":1000,"max_worker_threads":32767,"min_completion_port_threads":1,"min_worker_threads":8,"type":"ThreadPool Info"},"app":{"app_start_time":"2025-06-01T02:20:04.6947513+00:00","type":"app"},"device":{"name":"Pixel 5","family":"Pixel","model":"Pixel 5","model_id":"TQ3A.230901.001","arch":"arm64-v8a","battery_level":100.0,"orientation":"portrait","manufacturer":"Google","brand":"google","screen_resolution":"1080x2138","screen_density":2.75,"screen_dpi":440,"charging":true,"low_memory":false,"simulator":false,"memory_size":7824052224,"free_memory":2477084672,"storage_size":117153181696,"free_storage":96139882496,"boot_time":"2025-06-01T00:24:37.6935833+00:00","timezone":"America/New_York","device_unique_identifier":"2c40764ae1214a5a9c846c95dd901a87","timezone_display_name":"(UTC-05:00) Eastern Time (New York)","type":"device"},"os":{"os":"Android 13","name":"Android","version":"13","build":"TQ3A.230901.001","kernel_version":"4.19.269-g8728c337137c-ab10161573","rooted":false,"type":"os"},"runtime":{"runtime":".NET 9.0.4","name":".NET","version":"9.0.4","raw_description":".NET 9.0.4","identifier":"android-arm64","type":"runtime"},"trace":{"trace_id":"7271fcf62c6e47cfb7bc3e2bb3a17cd8","span_id":"3dc1fbc1eba20a7d","status":"unknown","origin":"manual","type":"trace"},"uname":{"Machine":"aarch64","Nodename":"localhost","Release":"4.19.269-g8728c337137c-ab10161573","Sysname":"Linux","Version":"#1 SMP PREEMPT Thu May 18 11:19:41 UTC 2023","type":"uname"}},"culprit":"","environment":"production","exception":{"values":[{"type":"Java.Lang.RuntimeException","value":"This exception was caused deliberately by SentrySdk.CauseCrash(CrashType.JavaBackgroundThread).","module":"Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065","thread_id":11,"mechanism":{"type":"AppDomain.UnhandledException","description":"This exception was caught by the .NET Application Domain global error handler. The application likely crashed as a result of this exception.","handled":false,"data":{"HResult":"0x80131500"}}}]},"extra":{"Metrics":{"AlreadyExistedCount":0,"DirectoryDoesNotExistCount":0,"ElfFileFoundCount":0,"FailedToParseCount":0,"FailedToUploadCount":0,"FatMachOFileFoundCount":0,"FileDoesNotExistCount":0,"FileOrDirectoryUnauthorizedAccessCount":null,"FilesProcessedCount":0,"JobsInFlightCount":0,"MachOFileFoundCount":0,"RanFor":"00:00:08.0177187","StartedTime":"2025-05-31T22:20:06.1215064-04:00","SuccessfullyUploadCount":0,"UploadedBytesCount":0}},"fingerprint":["{{ default }}"],"grouping_config":{"enhancements":"KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ#KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ#KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ","id":"newstyle:2023-01-11"},"hashes":["812799013fbde71b05e8113097ae13e7"],"ingest_path":[{"version":"25.5.1","public_key":"XE7QiyuNlja9PZ7I9qJlwQotzecWrUIN91BAO7Q5R38"}],"key_id":"1795050","level":"error","logger":"","metadata":{"type":"Java.Lang.RuntimeException","value":"This exception was caused deliberately by SentrySdk.CauseCrash(CrashType.JavaBackgroundThread)."},"modules":{"Java.Interop":"9.0.0.0","Microsoft.Extensions.Configuration":"9.0.0.0","Microsoft.Extensions.Configuration.Abstractions":"9.0.0.0","Microsoft.Extensions.Configuration.Binder":"9.0.0.0","Microsoft.Extensions.Configuration.FileExtensions":"9.0.0.0","Microsoft.Extensions.Configuration.Json":"9.0.0.0","Microsoft.Extensions.DependencyInjection":"9.0.0.0","Microsoft.Extensions.DependencyInjection.Abstractions":"9.0.0.0","Microsoft.Extensions.Diagnostics":"9.0.0.0","Microsoft.Extensions.Diagnostics.ExceptionSummarization":"9.0.0.0","Microsoft.Extensions.FileProviders.Abstractions":"9.0.0.0","Microsoft.Extensions.FileProviders.Physical":"9.0.0.0","Microsoft.Extensions.Hosting":"9.0.0.0","Microsoft.Extensions.Hosting.Abstractions":"9.0.0.0","Microsoft.Extensions.Http":"9.0.0.0","Microsoft.Extensions.Http.Resilience":"9.0.0.0","Microsoft.Extensions.Logging":"9.0.0.0","Microsoft.Extensions.Logging.Abstractions":"9.0.0.0","Microsoft.Extensions.Logging.Configuration":"9.0.0.0","Microsoft.Extensions.Logging.Console":"9.0.0.0","Microsoft.Extensions.Options":"9.0.0.0","Microsoft.Extensions.Options.ConfigurationExtensions":"9.0.0.0","Microsoft.Extensions.Primitives":"9.0.0.0","Microsoft.Maui.Essentials":"1.0.0.0","Mono.Android":"0.0.0.0","Mono.Android.Runtime":"0.0.0.0","Polly.Core":"8.0.0.0","Polly.Extensions":"8.0.0.0","Polly.RateLimiting":"8.0.0.0","Sentry":"5.9.0.0","Sentry.Android.AssemblyReader":"5.9.0.0","Sentry.Bindings.Android":"5.9.0.0","Sentry.Extensions.Logging":"5.9.0.0","SymbolCollector.Android":"1.23.0.0","SymbolCollector.Android.Library":"1.23.0.0","SymbolCollector.Core":"1.23.0.0","System.Collections":"9.0.0.0","System.Collections.Concurrent":"9.0.0.0","System.Collections.NonGeneric":"9.0.0.0","System.ComponentModel":"9.0.0.0","System.ComponentModel.Annotations":"9.0.0.0","System.ComponentModel.Primitives":"9.0.0.0","System.ComponentModel.TypeConverter":"9.0.0.0","System.Console":"9.0.0.0","System.Diagnostics.DiagnosticSource":"9.0.0.0","System.IO.Compression":"9.0.0.0","System.IO.Compression.Brotli":"9.0.0.0","System.IO.Pipelines":"9.0.0.0","System.Linq":"9.0.0.0","System.Linq.Expressions":"9.0.0.0","System.Memory":"9.0.0.0","System.Net.Http":"9.0.0.0","System.Net.Primitives":"9.0.0.0","System.Net.Requests":"9.0.0.0","System.Net.Security":"9.0.0.0","System.Net.WebProxy":"9.0.0.0","System.ObjectModel":"9.0.0.0","System.Private.CoreLib":"9.0.0.0","System.Private.Uri":"9.0.0.0","System.Reflection.Metadata":"9.0.0.0","System.Runtime":"9.0.0.0","System.Security.Cryptography":"9.0.0.0","System.Text.Encodings.Web":"9.0.0.0","System.Text.Json":"9.0.0.0","System.Text.RegularExpressions":"9.0.0.0","System.Threading.RateLimiting":"8.0.0.0","Xamarin.AndroidX.Core":"1.0.0.0"},"nodestore_insert":1748744413.389623,"received":1748744412.877255,"sdk":{"name":"sentry.dotnet.extensions.logging","version":"5.9.0","packages":[{"name":"nuget:sentry.dotnet","version":"5.9.0"},{"name":"nuget:Sentry.Extensions.Logging","version":"5.9.0"}]},"timestamp":1748744413.574565,"title":"Java.Lang.RuntimeException: This exception was caused deliberately by SentrySdk.CauseCrash(CrashType.JavaBackgroundThread).","type":"error","user":{"id":"40358816-2ec3-4509-8bf7-010aa72c21fa","ip_address":"66.85.52.52","username":"u0_a255","sentry_user":"id:40358816-2ec3-4509-8bf7-010aa72c21fa","geo":{"country_code":"US","city":"Santa Clara","subdivision":"California","region":"United States"}},"version":"7","location":null}

The native one has a stack trace (the Java file name and line number)

Native

Image

Image

Image

{"event_id":"0a22c79162a0406a9d497c047c7335e8","project":5953206,"release":"io.sentry.symbolcollector.android@1.23.0+1","dist":"1","platform":"java","message":"","datetime":"2025-06-01T02:20:13+00:00","tags":[["build-type","release"],["device","Pixel 5"],["device.class","2"],["device.family","Pixel"],["environment","production"],["handled","no"],["isSideLoaded","true"],["level","fatal"],["mechanism","UncaughtExceptionHandler"],["os","Android 13"],["os.name","Android"],["os.rooted","no"],["dist","1"],["release","io.sentry.symbolcollector.android@1.23.0+1"],["user","id:2c40764ae1214a5a9c846c95dd901a87"],["server-endpoint","https://symbol-collector.services.sentry.io/"],["user-agent","Dalvik/2.1.0 (Linux; U; Android 13; Pixel 5 Build/TQ3A.230901.001)"]],"_dsc":{"environment":"production","public_key":"656e2e78d37d4511a4ea2cb3602e7a65","release":"io.sentry.symbolcollector.android@1.23.0+1","replay_id":null,"sample_rand":"0.1005134502601192","trace_id":"3d1275b74c1c434ba7d8422f7a0c71aa","transaction":null},"_meta":{"extra":{"Metrics":{"":{"rem":[["@password:filter","s",0,10]],"len":420}}}},"_metrics":{"bytes.ingested.event":4522,"bytes.ingested.event.attachment":172661,"bytes.stored.event":6737,"bytes.stored.event.attachment":172661},"breadcrumbs":{"values":[{"timestamp":1748744405.692,"type":"navigation","category":"ui.lifecycle","level":"info","data":{"screen":"MainActivity","state":"created"}},{"timestamp":1748744406.365,"type":"navigation","category":"ui.lifecycle","level":"info","data":{"screen":"MainActivity","state":"started"}},{"timestamp":1748744406.367,"type":"navigation","category":"app.lifecycle","level":"info","data":{"state":"foreground"}},{"timestamp":1748744406.374,"type":"navigation","category":"ui.lifecycle","level":"info","data":{"screen":"MainActivity","state":"resumed"}},{"timestamp":1748744412.184,"type":"user","category":"ui.click","level":"info","data":{"view.class":"android.widget.Button","view.id":"btnUpload"}},{"timestamp":1748744412.191,"type":"default","category":"ui.event","level":"info","message":"OnUploadButtonOnClick"}]},"contexts":{"app":{"app_start_time":"2025-06-01T02:20:04.251Z","app_identifier":"io.sentry.symbolcollector.android","app_name":"Symbol Collector","app_version":"1.23.0","app_build":"1","in_foreground":true,"view_names":["io.sentry.symbolcollector.MainActivity"],"is_split_apks":false,"permissions":{"DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION":"granted","INTERNET":"granted","WAKE_LOCK":"granted"},"type":"app"},"device":{"name":"Pixel 5","family":"Pixel","model":"Pixel 5","model_id":"TQ3A.230901.001","battery_level":100.0,"orientation":"portrait","manufacturer":"Google","brand":"google","screen_width_pixels":1080,"screen_height_pixels":2138,"screen_density":2.75,"screen_dpi":440,"charging":true,"low_memory":false,"simulator":false,"memory_size":7824052224,"free_memory":2412662784,"storage_size":117153181696,"free_storage":96140177408,"boot_time":"2025-06-01T00:24:37.694Z","timezone":"America/New_York","locale":"en_GB","processor_count":8,"processor_frequency":2400,"archs":["arm64-v8a","armeabi-v7a","armeabi"],"battery_temperature":21.9,"id":"2c40764ae1214a5a9c846c95dd901a87","type":"device"},"os":{"os":"Android 13","name":"Android","version":"13","build":"TQ3A.230901.001","kernel_version":"4.19.269-g8728c337137c-ab10161573","rooted":false,"type":"os"},"trace":{"trace_id":"3d1275b74c1c434ba7d8422f7a0c71aa","span_id":"152ce0832d0240c2","op":"default","status":"unknown","origin":"manual","data":{"thread.name":"Thread-14","thread.id":"26899"},"type":"trace"}},"culprit":"io.sentry.android.supplemental.Buggy$1 in run","environment":"production","exception":{"values":[{"type":"RuntimeException","value":"This exception was caused deliberately by SentrySdk.CauseCrash(CrashType.JavaBackgroundThread).","module":"java.lang","stacktrace":{"frames":[{"function":"run","module":"io.sentry.android.supplemental.Buggy$1","filename":"Buggy.java","abs_path":"Buggy.java","lineno":13,"in_app":false,"data":{"orig_in_app":-1,"category":"framework"}}]},"raw_stacktrace":{"frames":[{"function":"run","module":"io.sentry.android.supplemental.Buggy$1","filename":"Buggy.java","abs_path":"Buggy.java","lineno":13,"in_app":false,"data":{"orig_in_app":-1,"category":"framework"}}]},"thread_id":120,"mechanism":{"type":"UncaughtExceptionHandler","handled":false,"exception_id":0}}]},"extra":{"Metrics":"[Filtered]"},"fingerprint":["{{ default }}"],"grouping_config":{"enhancements":"KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ#KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ#KLUv_SAYwQAAkwKRs25ld3N0eWxlOjIwMjMtMDEtMTGQ","id":"newstyle:2023-01-11"},"hashes":["d8df2e2783592e2717aa157d5ba12764"],"ingest_path":[{"version":"25.5.1","public_key":"XE7QiyuNlja9PZ7I9qJlwQotzecWrUIN91BAO7Q5R38"}],"key_id":"1795050","level":"fatal","location":"Buggy.java","logger":"","metadata":{"filename":"Buggy.java","function":"run","in_app_frame_mix":"system-only","type":"RuntimeException","value":"This exception was caused deliberately by SentrySdk.CauseCrash(CrashType.JavaBackgroundThread)."},"nodestore_insert":1748744413.107339,"received":1748744412.195124,"sdk":{"name":"sentry.java.android.dotnet","version":"8.6.0","integrations":["Screenshot","UncaughtExceptionHandler","ShutdownHook","SendCachedEnvelope","Ndk","EnvelopeFileObserver","AppLifecycle","AnrV2","ActivityLifecycle","ActivityBreadcrumbs","CurrentActivity","UserInteraction","AppComponentsBreadcrumbs","SystemEventsBreadcrumbs"],"packages":[{"name":"maven:io.sentry:sentry","version":"8.6.0"},{"name":"maven:io.sentry:sentry-android-core","version":"8.6.0"},{"name":"maven:io.sentry:sentry-android-replay","version":"8.6.0"},{"name":"maven:io.sentry:sentry-android-ndk","version":"8.6.0"}]},"timestamp":1748744413.241,"title":"RuntimeException: This exception was caused deliberately by SentrySdk.CauseCrash(CrashType.JavaBackgroundThread).","type":"error","user":{"id":"2c40764ae1214a5a9c846c95dd901a87","ip_address":"66.85.52.52","sentry_user":"id:2c40764ae1214a5a9c846c95dd901a87","geo":{"country_code":"US","city":"Santa Clara","subdivision":"California","region":"United States"}},"version":"7"}

Ideally we'd stop .NET from trying to capture this.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions