getsentry / getsentry/sentry-dotnet

[Sentry MAUI iOS] Add Attachements to native Crash Events on iOS

Open
#4,034 9 comments 1 reaction 0 assignees View on GitHub
.NET Attachments Framework: MAUI Improvement iOS Waiting for: Product Owner
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.