-
-
Notifications
You must be signed in to change notification settings - Fork 231
fix(unity): update SentryEvent to have IsCaptured to allow dropping screenshots of filtered events
#5162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(unity): update SentryEvent to have IsCaptured to allow dropping screenshots of filtered events
#5162
Changes from all commits
c1775cc
3cf527f
ea61d3e
75f83b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| #if SENTRY_UNITY | ||
|
|
||
| namespace Sentry; | ||
|
|
||
| public sealed partial class SentryEvent | ||
| { | ||
| /// <summary> | ||
| /// Indicates whether this event was actually captured and sent to Sentry. | ||
| /// Used by the Unity SDK's async screenshot capture to avoid sending orphaned attachments. | ||
| /// Defaults to false (safe: if unset, attachments are skipped rather than orphaned). | ||
| /// </summary> | ||
| internal bool IsCaptured { get; set; } | ||
| } | ||
|
|
||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -411,7 +411,14 @@ private SentryId DoSendEvent(SentryEvent @event, SentryHint? hint, Scope? scope) | |
|
|
||
| var attachments = hint.Attachments.ToList(); | ||
| var envelope = Envelope.FromEvent(processedEvent, _options.DiagnosticLogger, attachments, scope.SessionUpdate); | ||
| return CaptureEnvelope(envelope) ? processedEvent.EventId : SentryId.Empty; | ||
| if (CaptureEnvelope(envelope)) | ||
| { | ||
| #if SENTRY_UNITY | ||
| @event.IsCaptured = true; // See SentryEvent.Unity.cs for more details. | ||
| #endif | ||
|
Comment on lines
+416
to
+418
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jamescrosswell is this "pattern" alright? (adding a member via
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice and simple. The only alternative I can think of is that Unity could register a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not quite positive that this would work reliably, as there might be
So that it's a 100 % See also getsentry/sentry-unity#2642: "Future Ideas" |
||
| return processedEvent.EventId; | ||
| } | ||
| return SentryId.Empty; | ||
| } | ||
|
|
||
| private IReadOnlyCollection<Exception>? ApplyExceptionFilters(Exception? exception) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.