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
{{ message }}
Repository navigation
Add managed attachments to native Android events #3545
Generate crashes using SentrySdk.CauseCrash() with different parameters
Expected Result
All reported events should have logcat.log attachment with logcat logs and custom file.txt file attachment.
Actual Result
Crash generated with parameter CrashType.Native is reported with mechanism signalhandler and contains no attachments;
Crash generated with parameter CrashType.JavaBackgroundThread is reported twice: one with mechanism UncaughtExceptionHandler and contains no attachments, and another with mechanism AppDomain.UnhandledException and contains both attachments;
All other crash types (CrashType.Managed, CrashType.ManagedBackgroundThread, CrashType.Java) are reported with mechanism AppDomain.UnhandledException and contain both attachments.
The issue is also reproduced when ApplicationNotResponding is reported, no files are attached despite both logcat and custom attachments are configured.
Crash generated with parameter CrashType.JavaBackgroundThread is reported twice: one with mechanism UncaughtExceptionHandler and contains no attachments, and another with mechanism AppDomain.UnhandledException and contains both attachments;
I suspect the UncaughtExceptionHandler is coming from Java and the AppDomain.UnhandledException is coming from .NET.
@bitsandfoxes do you know what the expected behaviour is here?
Should the Java SDK be syncing it's scope via a scope action callback and so should it also contain the attachments?
Once the exception has been reported by Java, is there any way the .NET SDK could be aware of this and suppress further reporting? Or conversely, is there any way for the Java SDK to know this exception would be reported by the .NET SDK and so could safely ignore it?
Once the exception has been reported by Java, is there any way the .NET SDK could be aware of this and suppress further reporting? Or conversely, is there any way for the Java SDK to know this exception would be reported by the .NET SDK and so could safely ignore it?
I might have gotten that wrong but I was under the impression that the .NET SDK would be responsible for managed code and the Java SDK would provide native support. Having the same exception reported via the UncaughtExceptionHandler in Java and the AppDomain.UnhandledException is not ideal. But the reporting SDK is part of the event details.
I was under the impression that the .NET SDK would be responsible for managed code and the Java SDK would provide native support.
That's true, but you can add things to the scope (including attachments) that you want/expect to be sent with both Managed and Native exceptions. This hasn't been implemented for Attachments on Android yet.
Hi,
I know this has been stale for a bit, but we also would like to request this feature. Our app works a lot with unmanaged code which runs closely to mobile device firmware. Whenever we receive a native crash it is very hard to deduct where it originates from. So we have created out own log file with different states of different processes. It would benefit us very much to be able to attach it to the native reports.
logcat.log isn't a scope attachment: the .NET SDK reads logcat when it processes a managed event. Native crashes are captured by sentry-native inside sentry-java, so they never pass through that code, and syncing scope attachments (Scope sync attachments for Android, iOS and Native #5052) won't add it on its own.
sentry-java doesn't attach logcat itself. On Native events don't have logcat attachments #4845, a sentry-native maintainer suggested that a logcat integration in sentry-native could help every SDK, with the open question of whether logcat can be read safely when the crash happens. Another option is to read the logs on the next launch, when the crash report is sent.
This is now a sub-issue of #5052, which covers attachment sync on every platform.
Activity
TimBurik commentedon Aug 20, 2024
The issue is also reproduced when
ApplicationNotRespondingis reported, no files are attached despite both logcat and custom attachments are configured.jamescrosswell commentedon Aug 23, 2024
I think this is similar to:
In both cases, Native crash reporting essentially skips all the .NET SDK processing.
jamescrosswell commentedon Aug 25, 2024
I suspect the
UncaughtExceptionHandleris coming from Java and theAppDomain.UnhandledExceptionis coming from .NET.@bitsandfoxes do you know what the expected behaviour is here?
jamescrosswell commentedon Aug 25, 2024
Possibly relates to this (so maybe something that hasn't yet been implemented):
sentry-dotnet/src/Sentry/Platforms/Android/Extensions/AttachmentExtensions.cs
Lines 5 to 22 in 5fab09e
sentry-dotnet/src/Sentry/Platforms/Android/Extensions/HintExtensions.cs
Lines 13 to 16 in 5fab09e
bitsandfoxes commentedon Sep 4, 2024
I might have gotten that wrong but I was under the impression that the .NET SDK would be responsible for managed code and the Java SDK would provide native support. Having the same exception reported via the
UncaughtExceptionHandlerin Java and theAppDomain.UnhandledExceptionis not ideal. But the reporting SDK is part of the event details.jamescrosswell commentedon Sep 4, 2024
That's true, but you can add things to the scope (including attachments) that you want/expect to be sent with both Managed and Native exceptions. This hasn't been implemented for Attachments on Android yet.
48 remaining items
jamescrosswell commentedon Sep 3, 2025
OK thanks @TimBurik, that makes sense. And you're right, this hasn't yet been implemented in the hint extensions and the attachment extensions.
@Angelodaniel are you doing something similar or would this solve a different problem for you?
dalux-era commentedon Jul 10, 2026
Hi,
I know this has been stale for a bit, but we also would like to request this feature. Our app works a lot with unmanaged code which runs closely to mobile device firmware. Whenever we receive a native crash it is very hard to deduct where it originates from. So we have created out own log file with different states of different processes. It would benefit us very much to be able to attach it to the native reports.
jamescrosswell commentedon Nov 26, 2026
Adding the logcat details from #4845, now closed as a duplicate:
SIGSEGV,SIGABRT) still arrive withoutlogcat.log, which is when it would help most. fix: Android - make sure logcat.log is attached to unhandled event (SIGSEGV Segfault) #3694 attached it to those events but was later reverted.logcat.logisn't a scope attachment: the .NET SDK reads logcat when it processes a managed event. Native crashes are captured by sentry-native inside sentry-java, so they never pass through that code, and syncing scope attachments (Scope sync attachments for Android, iOS and Native #5052) won't add it on its own.This is now a sub-issue of #5052, which covers attachment sync on every platform.