getsentry / getsentry/sentry-dotnet
[Sentry MAUI iOS] Add Attachements to native Crash Events on iOS
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 49
Description
Creating new Feature request as suggested in [#3545]()
### Problem Statement
Sentry MAUI SDK does not have ability to attach files to native crash events on iOS.
**Package**
Sentry
**.NET Flavor**
.NET
**.NET Version**
8.0.407
**OS**
iOS
**SDK Version**
5.2.0
**Self-Hosted Sentry Version**
NA
**Steps to Reproduce**
1. Create a .NET MAUI iOS app and install Sentry NuGet package;
2. Configure Sentry so that reported events should have attachments:
```
SentrySdk.Init(options =>
{
options.Dsn = "...";
});
SentrySdk.ConfigureScope(scope =>
{
scope.AddAttachment("path/to/existing/file.txt", AttachmentType.Default, MediaTypeNames.Text.Plain);
});
```
1. Generate crashes using SentrySdk.CauseCrash(CrashType.Native)
**Expected Result**
All reported native crash events should have file.txt file added as an attachment.
**Actual Result**
Crash generated with parameter CrashType.Native is reported but contains no attachments.
### Solution Brainstorm
I have also attempted adding attachments to native crash events using the SetBeforeSend callback, but SetBeforeSend is not invoked for native crashes on iOS. This is already reported in [#3549]()
An option could be to invoke a callback (similar to [AppCenter's hasCrashedInLastSession()]()) where attachments and other additional information can be added to crash report before it is sent to Sentry.
Contributor guide
Assessment
This issue has not been assessed yet.