Skip to content

feat: Sync attachments on Android, Windows, and Linux#2609

Merged
bitsandfoxes merged 5 commits intomainfrom
feat/crash-attachents-android
Apr 2, 2026
Merged

feat: Sync attachments on Android, Windows, and Linux#2609
bitsandfoxes merged 5 commits intomainfrom
feat/crash-attachents-android

Conversation

@bitsandfoxes
Copy link
Copy Markdown
Contributor

Builds on:

With this, file and byte attachments get synced to the native layer on Android, Windows, and Linux and will be available on events originating from these layers.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Sync attachments on Android, Windows, and Linux by bitsandfoxes in #2609
  • Improve Xbox native support by bitsandfoxes in #2617

Internal Changes 🔧

Deps

  • Update .NET SDK to v6.3.0 by github-actions in #2615
  • Update Native SDK to v0.13.4 by github-actions in #2612
  • Update CLI to v3.3.5 by github-actions in #2614
  • Update CLI to v3.3.4 by github-actions in #2604
  • Update Java SDK to v8.37.1 by github-actions in #2605
  • Update Cocoa SDK to v9.8.0 by github-actions in #2596
  • Update Native SDK to v0.13.3 by github-actions in #2597
  • Update Java SDK to v8.36.0 by github-actions in #2591

Other

  • Update validate-pr workflow by stephanie-anderson in #2618
  • Add PR validation workflow by stephanie-anderson in #2608
  • Pin GitHub Actions to full-length commit SHAs by joshuarli in #2601

Other

  • Fix command injection vulnerability in iOS workflow by fix-it-felix-sentry in #2598

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against fcb705d

@bitsandfoxes bitsandfoxes requested a review from a team April 1, 2026 13:43
Comment on lines +168 to +175
[DllImport(SentryLib)]
internal static extern IntPtr sentry_attach_file(string path);

[DllImport(SentryLib)]
internal static extern IntPtr sentry_attach_bytes(byte[] buf, UIntPtr buf_len, string filename);

[DllImport(SentryLib)]
internal static extern void sentry_clear_attachments();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The contentType for attachments is silently discarded in the native implementation for Windows/Linux, as the P/Invoke calls sentry_attach_file and sentry_attach_bytes do not pass this parameter.
Severity: MEDIUM

Suggested Fix

Investigate if the underlying sentry-native C API supports setting the content type. If it does, update the P/Invoke signatures and the NativeScopeObserver.cs implementation to pass the contentType to the native layer. If not, add logging to warn the user that contentType is being ignored on native platforms.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/Sentry.Unity.Native/CFunctions.cs#L168-L175

Potential issue: The abstract `AddAttachment` method and its implementations in
`ScopeObserver` correctly handle a `contentType` parameter. However, the native
implementation for Windows/Linux in `NativeScopeObserver.cs` calls P/Invoke functions
(`sentry_attach_file` and `sentry_attach_bytes`) that do not accept a `contentType`.
This causes the content type information to be silently lost for attachments on these
platforms, creating an inconsistency with the Android implementation which correctly
preserves it. This degrades functionality by stripping metadata from native attachments.

Did we get this right? 👍 / 👎 to inform future reviews.

@bitsandfoxes bitsandfoxes merged commit e3c20dc into main Apr 2, 2026
36 checks passed
@bitsandfoxes bitsandfoxes deleted the feat/crash-attachents-android branch April 2, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants