Skip to content

feat: Added internal bool CaptureAttachment to Hub - #4357

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

bitsandfoxes merged 18 commits into
mainfrom
feat/capture-attachment

Conversation

@bitsandfoxes

@bitsandfoxes bitsandfoxes commented Jul 16, 2025 •

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Jul 16, 2025 •

Copy link
Copy Markdown
Contributor
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 Resolved
@bitsandfoxes
bitsandfoxes marked this pull request as ready for review July 16, 2025 16:32
Comment thread src/Sentry/Internal/Hub.cs Resolved
@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 Resolved
Comment thread test/Sentry.Tests/HubTests.cs Resolved
Comment thread test/Sentry.Tests/HubTests.cs Resolved
@bitsandfoxes
bitsandfoxes requested a review from Flash0ver July 18, 2025 08:53

@Flash0ver Flash0ver left a comment

Copy link
Copy Markdown
Contributor

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

var eventId = SentryId.Create();
var attachment = new SentryAttachment(
AttachmentType.Default,
new ByteAttachmentContent("test content"u8.ToArray()),

Copy link
Copy Markdown
Contributor

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.

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