Skip to content

feat: Added internal bool CaptureAttachment to Hub#4357

Merged
bitsandfoxes merged 18 commits intomainfrom
feat/capture-attachment
Jul 21, 2025
Merged

feat: Added internal bool CaptureAttachment to Hub#4357
bitsandfoxes merged 18 commits intomainfrom
feat/capture-attachment

Conversation

@bitsandfoxes
Copy link
Copy Markdown
Contributor

@bitsandfoxes bitsandfoxes commented Jul 16, 2025

It's possible to send attachments to Sentry on their own and still have them associated with an event. See dev docs.

This is something the Unity SDK would make use of. Since screenshot capture is not possible at the time the SDK captures an event, screenshot capture itself is delayed and the attachment is then sent separately.

We keep this as internal on the hub as this should not be user-facing.

#skip-changelog

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 16, 2025

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

Generated by 🚫 dangerJS against b0f890a

Comment thread src/Sentry/IHub.cs Outdated
@bitsandfoxes bitsandfoxes marked this pull request as ready for review July 16, 2025 16:32
Comment thread src/Sentry/Internal/Hub.cs
Comment thread src/Sentry/Platforms/Native/Sentry.Native.targets Outdated
@bitsandfoxes bitsandfoxes changed the title feat: Added internal bool CaptureAttachment to SentrySdk feat: Added internal bool CaptureAttachment to Hub Jul 17, 2025
Comment thread src/Sentry/Internal/Hub.cs
Comment thread src/Sentry/Protocol/Envelopes/Envelope.cs Outdated
Comment thread src/Sentry/Protocol/Envelopes/Envelope.cs Outdated
Comment thread src/Sentry/Protocol/Envelopes/Envelope.cs Outdated
Comment thread test/Sentry.Tests/HubTests.cs Outdated
Comment thread test/Sentry.Tests/HubTests.cs
Comment thread test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs
Comment thread test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs Outdated
@bitsandfoxes bitsandfoxes requested a review from Flash0ver July 18, 2025 08:53
Copy link
Copy Markdown
Member

@Flash0ver Flash0ver left a comment

Choose a reason for hiding this comment

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

thanks! ... I posted 2 more non-blocking comments

Comment thread test/Sentry.Testing/NullAttachmentContent.cs
var eventId = SentryId.Create();
var attachment = new SentryAttachment(
AttachmentType.Default,
new ByteAttachmentContent("test content"u8.ToArray()),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

question: could/should we add an internal constructor, that takes a ReadOnlySpan<byte>, so that we can omit the .ToArray() at the call sites?

internal ByteAttachmentContent(ReadOnlySpan<byte> bytes) => _bytes = bytes.ToArray();

Or is that overkill, because we only have 2 usages that would be shortened.

@bitsandfoxes bitsandfoxes merged commit 25a894d into main Jul 21, 2025
29 checks passed
@bitsandfoxes bitsandfoxes deleted the feat/capture-attachment branch July 21, 2025 14:05
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.

4 participants