getsentry / getsentry/sentry-dotnet
Add managed attachments to native Android events
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 49
Description
### Package
Sentry
### .NET Flavor
.NET
### .NET Version
8.0.303
### OS
Android
### SDK Version
4.10.1
### Self-Hosted Sentry Version
_No response_
### Steps to Reproduce
1. Create an Android app and install Sentry NuGet package;
2. Configure Sentry so that reported events should have attachments (both logcat and custom attachments are affected by the issue):
```
SentrySdk.Init(options =>
{
options.Dsn = "...";
options.Android.LogCatIntegration = LogCatIntegrationType.All;
});
SentrySdk.ConfigureScope(scope =>
{
scope.AddAttachment("path/to/existing/file.txt", AttachmentType.Default, MediaTypeNames.Text.Plain);
});
```
3. 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.
This issue might be related to [#3461](https://github.com/getsentry/sentry-dotnet/issues/3461)
Reproduction sample: [SampleProject.zip](https://github.com/user-attachments/files/16675998/SampleProject.zip)
Contributor guide
Assessment
This issue has not been assessed yet.