From eb34329a56f59fb2f7c5edf13306a088a1fe1f3c Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 4 May 2026 16:11:43 +1200 Subject: [PATCH 01/11] feat: Add AddToTransactions flag to SentryAttachment Adds an `AddToTransactions` boolean property to `SentryAttachment` (default `false`) that controls whether attachments are included in transaction envelopes. Previously attachments were never sent with transactions; now those with `AddToTransactions = true` are included. Closes #750 Co-Authored-By: Claude Sonnet 4.6 --- src/Sentry/Protocol/Envelopes/Envelope.cs | 19 ++++- src/Sentry/SentryAttachment.cs | 20 +++++ src/Sentry/SentryClient.cs | 3 +- ...iApprovalTests.Run.DotNet10_0.verified.txt | 4 +- ...piApprovalTests.Run.DotNet8_0.verified.txt | 4 +- ...piApprovalTests.Run.DotNet9_0.verified.txt | 4 +- test/Sentry.Tests/SentryClientTests.cs | 75 +++++++++++++++++++ 7 files changed, 124 insertions(+), 5 deletions(-) diff --git a/src/Sentry/Protocol/Envelopes/Envelope.cs b/src/Sentry/Protocol/Envelopes/Envelope.cs index 227c572797..0b6ebf9104 100644 --- a/src/Sentry/Protocol/Envelopes/Envelope.cs +++ b/src/Sentry/Protocol/Envelopes/Envelope.cs @@ -337,7 +337,10 @@ public static Envelope FromFeedback( /// /// Creates an envelope that contains a single transaction. /// - public static Envelope FromTransaction(SentryTransaction transaction) + public static Envelope FromTransaction( + SentryTransaction transaction, + IDiagnosticLogger? logger = null, + IReadOnlyCollection? attachments = null) { var eventId = transaction.EventId; var header = CreateHeader(eventId, transaction.DynamicSamplingContext); @@ -358,6 +361,20 @@ public static Envelope FromTransaction(SentryTransaction transaction) } } + if (attachments is not null) + { + foreach (var attachment in attachments) + { + if (attachment.IsNull()) + { + logger?.LogWarning("Encountered a null attachment. Skipping."); + continue; + } + + AddEnvelopeItemFromAttachment(items, attachment, logger); + } + } + return new Envelope(eventId, header, items); } diff --git a/src/Sentry/SentryAttachment.cs b/src/Sentry/SentryAttachment.cs index 0249fc589f..c57dc96ed4 100644 --- a/src/Sentry/SentryAttachment.cs +++ b/src/Sentry/SentryAttachment.cs @@ -65,6 +65,12 @@ public class SentryAttachment /// public string? ContentType { get; } + /// + /// Whether the attachment should be added to transactions. + /// Defaults to false. + /// + public bool AddToTransactions { get; } + /// /// Initializes an instance of . /// @@ -73,10 +79,24 @@ public SentryAttachment( IAttachmentContent content, string fileName, string? contentType) + : this(type, content, fileName, contentType, false) + { + } + + /// + /// Initializes an instance of . + /// + public SentryAttachment( + AttachmentType type, + IAttachmentContent content, + string fileName, + string? contentType, + bool addToTransactions) { Type = type; Content = content; FileName = fileName; ContentType = contentType; + AddToTransactions = addToTransactions; } } diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs index 74f961081d..cc3eec0ddb 100644 --- a/src/Sentry/SentryClient.cs +++ b/src/Sentry/SentryClient.cs @@ -215,7 +215,8 @@ public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Sent processedTransaction.Redact(); } - CaptureEnvelope(Envelope.FromTransaction(processedTransaction)); + var attachments = hint.Attachments.Where(a => a.AddToTransactions).ToList(); + CaptureEnvelope(Envelope.FromTransaction(processedTransaction, _options.DiagnosticLogger, attachments)); } #if NET6_0_OR_GREATER diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt index ccf866768e..d60b9ea1fe 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt @@ -437,6 +437,8 @@ namespace Sentry public class SentryAttachment { public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType, bool addToTransactions) { } + public bool AddToTransactions { get; } public Sentry.IAttachmentContent Content { get; } public string? ContentType { get; } public string FileName { get; } @@ -2007,7 +2009,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index ccf866768e..d60b9ea1fe 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -437,6 +437,8 @@ namespace Sentry public class SentryAttachment { public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType, bool addToTransactions) { } + public bool AddToTransactions { get; } public Sentry.IAttachmentContent Content { get; } public string? ContentType { get; } public string FileName { get; } @@ -2007,7 +2009,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index ccf866768e..d60b9ea1fe 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -437,6 +437,8 @@ namespace Sentry public class SentryAttachment { public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType, bool addToTransactions) { } + public bool AddToTransactions { get; } public Sentry.IAttachmentContent Content { get; } public string? ContentType { get; } public string FileName { get; } @@ -2007,7 +2009,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index 8aa842e2cb..1384909f0e 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -1294,6 +1294,81 @@ public void CaptureTransaction_ScopeContainsAttachments_GetAppliedToHint() hint.Attachments.Should().Contain(attachments); } + [Fact] + public void CaptureTransaction_AttachmentWithAddToTransactionsTrue_IncludedInEnvelope() + { + // Arrange + var transaction = new SentryTransaction("name", "operation") + { + IsSampled = true, + EndTimestamp = DateTimeOffset.Now + }; + var attachment = new SentryAttachment( + AttachmentType.Default, + new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), + "include.txt", + null, + addToTransactions: true); + var scope = new Scope(_fixture.SentryOptions); + scope.AddAttachment(attachment); + var sut = _fixture.GetSut(); + + // Act + sut.CaptureTransaction(transaction, scope, null); + + // Assert + sut.Worker.Received(1).EnqueueEnvelope(Arg.Is(envelope => + envelope.Items.Count(item => item.TryGetType() == "attachment") == 1)); + } + + [Fact] + public void CaptureTransaction_AttachmentWithAddToTransactionsFalse_ExcludedFromEnvelope() + { + // Arrange + var transaction = new SentryTransaction("name", "operation") + { + IsSampled = true, + EndTimestamp = DateTimeOffset.Now + }; + var scope = new Scope(_fixture.SentryOptions); + scope.AddAttachment(AttachmentHelper.FakeAttachment("exclude.txt")); // default: AddToTransactions = false + var sut = _fixture.GetSut(); + + // Act + sut.CaptureTransaction(transaction, scope, null); + + // Assert + sut.Worker.Received(1).EnqueueEnvelope(Arg.Is(envelope => + envelope.Items.Count(item => item.TryGetType() == "attachment") == 0)); + } + + [Fact] + public void CaptureTransaction_MixedAttachments_OnlyAddToTransactionsOnesIncluded() + { + // Arrange + var transaction = new SentryTransaction("name", "operation") + { + IsSampled = true, + EndTimestamp = DateTimeOffset.Now + }; + var scope = new Scope(_fixture.SentryOptions); + scope.AddAttachment(AttachmentHelper.FakeAttachment("excluded.txt")); // AddToTransactions = false + scope.AddAttachment(new SentryAttachment( + AttachmentType.Default, + new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), + "included.txt", + null, + addToTransactions: true)); + var sut = _fixture.GetSut(); + + // Act + sut.CaptureTransaction(transaction, scope, null); + + // Assert + sut.Worker.Received(1).EnqueueEnvelope(Arg.Is(envelope => + envelope.Items.Count(item => item.TryGetType() == "attachment") == 1)); + } + [Fact] public void CaptureTransaction_UserIsNull_SetsFallbackUserId() { From 39fe419a956b4c67a1f8eda07974ae4f3354e855 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 5 May 2026 14:02:18 +1200 Subject: [PATCH 02/11] Windows verify tests --- test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 1fc1e68f4b..7931551341 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -425,6 +425,8 @@ namespace Sentry public class SentryAttachment { public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType) { } + public SentryAttachment(Sentry.AttachmentType type, Sentry.IAttachmentContent content, string fileName, string? contentType, bool addToTransactions) { } + public bool AddToTransactions { get; } public Sentry.IAttachmentContent Content { get; } public string? ContentType { get; } public string FileName { get; } @@ -1983,7 +1985,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { From 416ec0b4020581b17078c2af624bd5d8661d7747 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 5 May 2026 16:29:16 +1200 Subject: [PATCH 03/11] fix: Preserve binary compatibility of Envelope.FromTransaction Replace the optional-parameter signature with two explicit overloads: - original single-arg overload delegates to the new one (binary compat) - new overload takes logger + attachments without defaults Co-Authored-By: Claude Sonnet 4.6 --- src/Sentry/Protocol/Envelopes/Envelope.cs | 10 ++++++++-- .../ApiApprovalTests.Run.DotNet10_0.verified.txt | 3 ++- .../ApiApprovalTests.Run.DotNet8_0.verified.txt | 3 ++- .../ApiApprovalTests.Run.DotNet9_0.verified.txt | 3 ++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Sentry/Protocol/Envelopes/Envelope.cs b/src/Sentry/Protocol/Envelopes/Envelope.cs index 0b6ebf9104..724d567d96 100644 --- a/src/Sentry/Protocol/Envelopes/Envelope.cs +++ b/src/Sentry/Protocol/Envelopes/Envelope.cs @@ -337,10 +337,16 @@ public static Envelope FromFeedback( /// /// Creates an envelope that contains a single transaction. /// + public static Envelope FromTransaction(SentryTransaction transaction) => + FromTransaction(transaction, null, null); + + /// + /// Creates an envelope that contains a single transaction and optional attachments. + /// public static Envelope FromTransaction( SentryTransaction transaction, - IDiagnosticLogger? logger = null, - IReadOnlyCollection? attachments = null) + IDiagnosticLogger? logger, + IReadOnlyCollection? attachments) { var eventId = transaction.EventId; var header = CreateHeader(eventId, transaction.DynamicSamplingContext); diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt index d60b9ea1fe..3cc6cbf096 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt @@ -2009,7 +2009,8 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index d60b9ea1fe..3cc6cbf096 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -2009,7 +2009,8 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index d60b9ea1fe..3cc6cbf096 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -2009,7 +2009,8 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { From 29b2db3b69d284ed5a8a85669329a053cecec90e Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 7 May 2026 12:39:38 +1200 Subject: [PATCH 04/11] Windows verify tests --- test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 7931551341..0eb621d233 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -1985,7 +1985,8 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { From 0ee50c0db8fcaeef33332713e3ec5d62bdddeb91 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 7 May 2026 15:15:17 +1200 Subject: [PATCH 05/11] test: Remove redundant mixed-attachments transaction test The two focused tests (true includes, false excludes) already cover the filtering logic completely. The mixed-attachments test added no additional coverage. Co-Authored-By: Claude Sonnet 4.6 --- test/Sentry.Tests/SentryClientTests.cs | 27 -------------------------- 1 file changed, 27 deletions(-) diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index 1384909f0e..ed3ce1b8d2 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -1342,33 +1342,6 @@ public void CaptureTransaction_AttachmentWithAddToTransactionsFalse_ExcludedFrom envelope.Items.Count(item => item.TryGetType() == "attachment") == 0)); } - [Fact] - public void CaptureTransaction_MixedAttachments_OnlyAddToTransactionsOnesIncluded() - { - // Arrange - var transaction = new SentryTransaction("name", "operation") - { - IsSampled = true, - EndTimestamp = DateTimeOffset.Now - }; - var scope = new Scope(_fixture.SentryOptions); - scope.AddAttachment(AttachmentHelper.FakeAttachment("excluded.txt")); // AddToTransactions = false - scope.AddAttachment(new SentryAttachment( - AttachmentType.Default, - new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), - "included.txt", - null, - addToTransactions: true)); - var sut = _fixture.GetSut(); - - // Act - sut.CaptureTransaction(transaction, scope, null); - - // Assert - sut.Worker.Received(1).EnqueueEnvelope(Arg.Is(envelope => - envelope.Items.Count(item => item.TryGetType() == "attachment") == 1)); - } - [Fact] public void CaptureTransaction_UserIsNull_SetsFallbackUserId() { From a8edc5d48e9138161fe53761eab7627ea9bfc2e3 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 13 Jul 2026 14:03:30 +1200 Subject: [PATCH 06/11] feat: Expose addToTransactions on derived SentryAttachment types Adds an overloaded ViewHierarchyAttachment constructor accepting addToTransactions and forwards it to the base type, and plumbs the flag through the internal ScreenshotAttachment constructor. Addresses the PR review question about offering the flag consistently on derived attachment types. Co-Authored-By: Claude Opus 4.8 --- .../Internal/ScreenshotAttachment.cs | 5 +++-- src/Sentry/ViewHierarchyAttachment.cs | 15 ++++++++++--- ...iApprovalTests.Run.DotNet10_0.verified.txt | 1 + ...piApprovalTests.Run.DotNet8_0.verified.txt | 1 + ...piApprovalTests.Run.DotNet9_0.verified.txt | 1 + .../ApiApprovalTests.Run.Net4_8.verified.txt | 1 + test/Sentry.Tests/AttachmentTests.cs | 22 +++++++++++++++++++ 7 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/Sentry.Maui/Internal/ScreenshotAttachment.cs b/src/Sentry.Maui/Internal/ScreenshotAttachment.cs index 6d8a2e7cf6..fe0c8552db 100644 --- a/src/Sentry.Maui/Internal/ScreenshotAttachment.cs +++ b/src/Sentry.Maui/Internal/ScreenshotAttachment.cs @@ -17,8 +17,9 @@ private ScreenshotAttachment( AttachmentType type, IAttachmentContent content, string fileName, - string? contentType) - : base(type, content, fileName, contentType) + string? contentType, + bool addToTransactions = false) + : base(type, content, fileName, contentType, addToTransactions) { } } diff --git a/src/Sentry/ViewHierarchyAttachment.cs b/src/Sentry/ViewHierarchyAttachment.cs index d71e9e8db5..658ea52305 100644 --- a/src/Sentry/ViewHierarchyAttachment.cs +++ b/src/Sentry/ViewHierarchyAttachment.cs @@ -8,8 +8,17 @@ public class ViewHierarchyAttachment : SentryAttachment /// /// Initializes an instance of . /// - /// /// The view hierarchy attachment - public ViewHierarchyAttachment(IAttachmentContent content) : - base(AttachmentType.ViewHierarchy, content, "view-hierarchy.json", "application/json") + /// The view hierarchy attachment + public ViewHierarchyAttachment(IAttachmentContent content) + : this(content, false) + { } + + /// + /// Initializes an instance of . + /// + /// The view hierarchy attachment + /// Whether the attachment should be added to transactions. + public ViewHierarchyAttachment(IAttachmentContent content, bool addToTransactions) + : base(AttachmentType.ViewHierarchy, content, "view-hierarchy.json", "application/json", addToTransactions) { } } diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt index 3cc6cbf096..8f037b886f 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt @@ -1407,6 +1407,7 @@ namespace Sentry public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } + public ViewHierarchyAttachment(Sentry.IAttachmentContent content, bool addToTransactions) { } } public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index 3cc6cbf096..8f037b886f 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -1407,6 +1407,7 @@ namespace Sentry public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } + public ViewHierarchyAttachment(Sentry.IAttachmentContent content, bool addToTransactions) { } } public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index 3cc6cbf096..8f037b886f 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -1407,6 +1407,7 @@ namespace Sentry public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } + public ViewHierarchyAttachment(Sentry.IAttachmentContent content, bool addToTransactions) { } } public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index 0eb621d233..1af264ab59 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -1388,6 +1388,7 @@ namespace Sentry public class ViewHierarchyAttachment : Sentry.SentryAttachment { public ViewHierarchyAttachment(Sentry.IAttachmentContent content) { } + public ViewHierarchyAttachment(Sentry.IAttachmentContent content, bool addToTransactions) { } } public abstract class ViewHierarchyNode : Sentry.ISentryJsonSerializable { diff --git a/test/Sentry.Tests/AttachmentTests.cs b/test/Sentry.Tests/AttachmentTests.cs index 95a3666eca..7e39ba599a 100644 --- a/test/Sentry.Tests/AttachmentTests.cs +++ b/test/Sentry.Tests/AttachmentTests.cs @@ -24,6 +24,28 @@ public void GetStream_ReturnsBytesContent() } } +public class ViewHierarchyAttachmentTests +{ + [Fact] + public void Ctor_DefaultsAddToTransactionsToFalse() + { + var attachment = new ViewHierarchyAttachment(new ByteAttachmentContent(new byte[] { 1 })); + Assert.False(attachment.AddToTransactions); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public void Ctor_ForwardsAddToTransactions(bool addToTransactions) + { + var attachment = new ViewHierarchyAttachment( + new ByteAttachmentContent(new byte[] { 1 }), + addToTransactions); + + Assert.Equal(addToTransactions, attachment.AddToTransactions); + } +} + public class FileAttachmentContentTests { [Fact] From 1d0635b108a900f08dc130c9aef6aad94fde0e20 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 13 Jul 2026 14:28:09 +1200 Subject: [PATCH 07/11] test: Cover null-attachment skipping in Envelope.FromTransaction Adds a test asserting that a null element in the attachments collection is skipped (not added as an envelope item) and that a warning is logged. Addresses the PR review coverage nitpick. Co-Authored-By: Claude Opus 4.8 --- .../Protocol/Envelopes/EnvelopeTests.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs b/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs index 1835016cf9..732820851e 100644 --- a/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs +++ b/test/Sentry.Tests/Protocol/Envelopes/EnvelopeTests.cs @@ -753,6 +753,34 @@ public async Task Roundtrip_WithEvent_WithAttachment_Success() envelopeRoundtrip.Items[1].TryGetOrRecalculateLength().Should().Be(attachment.Content.GetStream().Length); } + [Fact] + public void FromTransaction_WithNullAttachment_SkipsItAndLogsWarning() + { + // Arrange + var tracer = new TransactionTracer(DisabledHub.Instance, "name", "op"); + var transaction = new SentryTransaction(tracer); + + using var attachmentStream = new MemoryStream(new byte[] { 1, 2, 3 }); + var validAttachment = new SentryAttachment( + AttachmentType.Default, + new StreamAttachmentContent(attachmentStream), + "file.txt", + null); + + var attachments = new List { null!, validAttachment }; + var logger = new InMemoryDiagnosticLogger(); + + // Act + using var envelope = Envelope.FromTransaction(transaction, logger, attachments); + + // Assert + // Only the transaction item and the single valid attachment - the null is skipped. + envelope.Items.Count(item => item.TryGetType() == "attachment").Should().Be(1); + logger.Entries.Should().ContainSingle(e => + e.Level == SentryLevel.Warning && + e.Message == "Encountered a null attachment. Skipping."); + } + [Fact] public async Task Roundtrip_WithEvent_WithSession_Success() { From 748a7e5350244ad6f078f9c10ba907d29d3d5efe Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 13 Jul 2026 14:30:03 +1200 Subject: [PATCH 08/11] test: Thread addToTransactions through AttachmentHelper.FakeAttachment Adds an optional addToTransactions parameter to the test helper and uses it to shorten the AddToTransactionsTrue test, keeping it consistent with the AddToTransactionsFalse test. Addresses the PR review suggestion. Co-Authored-By: Claude Opus 4.8 --- test/Sentry.Tests/AttachmentHelper.cs | 5 +++-- test/Sentry.Tests/SentryClientTests.cs | 7 +------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/test/Sentry.Tests/AttachmentHelper.cs b/test/Sentry.Tests/AttachmentHelper.cs index 562313fb2a..daa2e7b640 100644 --- a/test/Sentry.Tests/AttachmentHelper.cs +++ b/test/Sentry.Tests/AttachmentHelper.cs @@ -2,12 +2,13 @@ namespace Sentry.Tests { internal static class AttachmentHelper { - internal static SentryAttachment FakeAttachment(string name = "test.txt") + internal static SentryAttachment FakeAttachment(string name = "test.txt", bool addToTransactions = false) => new( AttachmentType.Default, new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), name, - null + null, + addToTransactions ); } } diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index ed3ce1b8d2..bd40b799dd 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -1303,12 +1303,7 @@ public void CaptureTransaction_AttachmentWithAddToTransactionsTrue_IncludedInEnv IsSampled = true, EndTimestamp = DateTimeOffset.Now }; - var attachment = new SentryAttachment( - AttachmentType.Default, - new StreamAttachmentContent(new MemoryStream(new byte[] { 1 })), - "include.txt", - null, - addToTransactions: true); + var attachment = AttachmentHelper.FakeAttachment("include.txt", addToTransactions: true); var scope = new Scope(_fixture.SentryOptions); scope.AddAttachment(attachment); var sut = _fixture.GetSut(); From 56aa34ef07cadd543590a2866d138a30735fd4ec Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 13 Jul 2026 14:38:58 +1200 Subject: [PATCH 09/11] fix: Guard against null attachments in transaction capture hint.Attachments is a mutable public collection, so it can contain a null entry. Filtering it with Where(a => a.AddToTransactions) dereferenced each element and threw a NullReferenceException, dropping the whole transaction before Envelope.FromTransaction could skip the null. The event and feedback paths already defer null handling to the envelope's IsNull guard; mirror that by letting null entries flow through the client-side filter instead of dereferencing them. Co-Authored-By: Claude Opus 4.8 --- src/Sentry/SentryClient.cs | 4 +++- test/Sentry.Tests/SentryClientTests.cs | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Sentry/SentryClient.cs b/src/Sentry/SentryClient.cs index 09fa7779bd..8bded1c002 100644 --- a/src/Sentry/SentryClient.cs +++ b/src/Sentry/SentryClient.cs @@ -223,7 +223,9 @@ public void CaptureTransaction(SentryTransaction transaction, Scope? scope, Sent processedTransaction.Redact(); } - var attachments = hint.Attachments.Where(a => a.AddToTransactions).ToList(); + // Keep null entries so the null-attachment guard in Envelope.FromTransaction handles them + // (consistent with the event/feedback capture paths); dereferencing them here would throw. + var attachments = hint.Attachments.Where(a => a is null || a.AddToTransactions).ToList(); CaptureEnvelope(Envelope.FromTransaction(processedTransaction, _options.DiagnosticLogger, attachments)); } diff --git a/test/Sentry.Tests/SentryClientTests.cs b/test/Sentry.Tests/SentryClientTests.cs index 48f1834137..3cb379e9d6 100644 --- a/test/Sentry.Tests/SentryClientTests.cs +++ b/test/Sentry.Tests/SentryClientTests.cs @@ -1453,6 +1453,32 @@ public void CaptureTransaction_AttachmentWithAddToTransactionsFalse_ExcludedFrom envelope.Items.Count(item => item.TryGetType() == "attachment") == 0)); } + [Fact] + public void CaptureTransaction_NullAttachmentInHint_DoesNotThrowAndSkipsNull() + { + // Arrange + var transaction = new SentryTransaction("name", "operation") + { + IsSampled = true, + EndTimestamp = DateTimeOffset.Now + }; + var scope = new Scope(_fixture.SentryOptions); + var sut = _fixture.GetSut(); + + // A null entry in the hint's attachments must not crash transaction capture. + var hint = new SentryHint(); + hint.Attachments.Add(null!); + hint.Attachments.Add(AttachmentHelper.FakeAttachment("include.txt", addToTransactions: true)); + + // Act + var capture = () => sut.CaptureTransaction(transaction, scope, hint); + + // Assert + capture.Should().NotThrow(); + sut.Worker.Received(1).EnqueueEnvelope(Arg.Is(envelope => + envelope.Items.Count(item => item.TryGetType() == "attachment") == 1)); + } + [SkippableFact] public void CaptureTransaction_UserIsNull_SetsFallbackUserId() { From c70ef2a4f70e263f1bb223152c7648012a2b7f9c Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 17 Jul 2026 11:10:36 +1200 Subject: [PATCH 10/11] refactor: Simplify ScreenshotAttachment constructor Revert the addToTransactions plumbing on ScreenshotAttachment. The parameter had been added only to the private constructor, so nothing could set it. ScreenshotAttachment is internal and its content is always a JPEG screenshot, so there's no consumer for the flag; keeping it added dead surface area. Also drop the now-redundant private constructor and have the public constructor delegate straight to the base type. Co-Authored-By: Claude Opus 4.8 --- src/Sentry.Maui/Internal/ScreenshotAttachment.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Sentry.Maui/Internal/ScreenshotAttachment.cs b/src/Sentry.Maui/Internal/ScreenshotAttachment.cs index fe0c8552db..df18fba25f 100644 --- a/src/Sentry.Maui/Internal/ScreenshotAttachment.cs +++ b/src/Sentry.Maui/Internal/ScreenshotAttachment.cs @@ -5,23 +5,13 @@ namespace Sentry.Maui.Internal; internal class ScreenshotAttachment : SentryAttachment { public ScreenshotAttachment(SentryMauiOptions options) - : this( + : base( AttachmentType.Default, new ScreenshotAttachmentContent(options), "screenshot.jpg", "image/jpeg") { } - - private ScreenshotAttachment( - AttachmentType type, - IAttachmentContent content, - string fileName, - string? contentType, - bool addToTransactions = false) - : base(type, content, fileName, contentType, addToTransactions) - { - } } internal class ScreenshotAttachmentContent : IAttachmentContent From 2496a53719c7f970a2e043bc1bf4facfa540e5e7 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 17 Jul 2026 13:13:41 +1200 Subject: [PATCH 11/11] refactor!: Collapse Envelope.FromTransaction overloads into one Replace the two FromTransaction overloads with a single method whose logger and attachments parameters default to null, matching the sibling FromEvent and FromFeedback factory methods. The parameterless-tail overload was only used in tests; all call sites bind to the collapsed method unchanged. This removes the FromTransaction(SentryTransaction) overload, which is a binary-breaking change for precompiled consumers. Closes #5397 Co-Authored-By: Claude Opus 4.8 --- src/Sentry/Protocol/Envelopes/Envelope.cs | 10 ++-------- .../ApiApprovalTests.Run.DotNet10_0.verified.txt | 3 +-- .../ApiApprovalTests.Run.DotNet8_0.verified.txt | 3 +-- .../ApiApprovalTests.Run.DotNet9_0.verified.txt | 3 +-- .../ApiApprovalTests.Run.Net4_8.verified.txt | 3 +-- 5 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Sentry/Protocol/Envelopes/Envelope.cs b/src/Sentry/Protocol/Envelopes/Envelope.cs index 724d567d96..e70a80526f 100644 --- a/src/Sentry/Protocol/Envelopes/Envelope.cs +++ b/src/Sentry/Protocol/Envelopes/Envelope.cs @@ -334,19 +334,13 @@ public static Envelope FromFeedback( return new Envelope(eventId, header, items); } - /// - /// Creates an envelope that contains a single transaction. - /// - public static Envelope FromTransaction(SentryTransaction transaction) => - FromTransaction(transaction, null, null); - /// /// Creates an envelope that contains a single transaction and optional attachments. /// public static Envelope FromTransaction( SentryTransaction transaction, - IDiagnosticLogger? logger, - IReadOnlyCollection? attachments) + IDiagnosticLogger? logger = null, + IReadOnlyCollection? attachments = null) { var eventId = transaction.EventId; var header = CreateHeader(eventId, transaction.DynamicSamplingContext); diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt index c69e0eb5b9..fe4834dee2 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet10_0.verified.txt @@ -2020,8 +2020,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt index c69e0eb5b9..fe4834dee2 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet8_0.verified.txt @@ -2020,8 +2020,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt index c69e0eb5b9..fe4834dee2 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.DotNet9_0.verified.txt @@ -2020,8 +2020,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable { diff --git a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt index ea1090084d..3e8e2017ec 100644 --- a/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt +++ b/test/Sentry.Tests/ApiApprovalTests.Run.Net4_8.verified.txt @@ -1996,8 +1996,7 @@ namespace Sentry.Protocol.Envelopes public static Sentry.Protocol.Envelopes.Envelope FromEvent(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromFeedback(Sentry.SentryEvent @event, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null, Sentry.SessionUpdate? sessionUpdate = null) { } public static Sentry.Protocol.Envelopes.Envelope FromSession(Sentry.SessionUpdate sessionUpdate) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction) { } - public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger, System.Collections.Generic.IReadOnlyCollection? attachments) { } + public static Sentry.Protocol.Envelopes.Envelope FromTransaction(Sentry.SentryTransaction transaction, Sentry.Extensibility.IDiagnosticLogger? logger = null, System.Collections.Generic.IReadOnlyCollection? attachments = null) { } } public sealed class EnvelopeItem : Sentry.Protocol.Envelopes.ISerializable, System.IDisposable {