Background
Follow-up from #5182 (review).
That PR adds an AddToTransactions flag to the base SentryAttachment via an overloaded constructor:
public SentryAttachment(
AttachmentType type,
IAttachmentContent content,
string fileName,
string? contentType,
bool addToTransactions)
As @Flash0ver asked, the derived attachment types don't currently expose this flag — their constructors call base(...) without it, so addToTransactions is always false. There are two subclasses:
ViewHierarchyAttachment — public (core Sentry). Its single ctor takes only IAttachmentContent and hard-codes the base call, so there's no way for a consumer to opt a view-hierarchy attachment into transactions.
ScreenshotAttachment — internal (Sentry.Maui.Internal). Not part of the public API, but the flag could still be plumbed internally if we want screenshots addable to transactions.
Proposal
Offer the addToTransactions flag on the derived attachment types too, so it can be set consistently:
- Add an overloaded
ViewHierarchyAttachment ctor that accepts bool addToTransactions and forwards it to base(...).
- Plumb the flag through
ScreenshotAttachment internally as needed (no public surface change required since it's internal).
This is additive (a new overload), so it is not a breaking change and doesn't need to wait for a major.
Acceptance criteria
Background
Follow-up from #5182 (review).
That PR adds an
AddToTransactionsflag to the baseSentryAttachmentvia an overloaded constructor:As @Flash0ver asked, the derived attachment types don't currently expose this flag — their constructors call
base(...)without it, soaddToTransactionsis alwaysfalse. There are two subclasses:ViewHierarchyAttachment— public (coreSentry). Its single ctor takes onlyIAttachmentContentand hard-codes the base call, so there's no way for a consumer to opt a view-hierarchy attachment into transactions.ScreenshotAttachment— internal (Sentry.Maui.Internal). Not part of the public API, but the flag could still be plumbed internally if we want screenshots addable to transactions.Proposal
Offer the
addToTransactionsflag on the derived attachment types too, so it can be set consistently:ViewHierarchyAttachmentctor that acceptsbool addToTransactionsand forwards it tobase(...).ScreenshotAttachmentinternally as needed (no public surface change required since it's internal).This is additive (a new overload), so it is not a breaking change and doesn't need to wait for a major.
Acceptance criteria
ViewHierarchyAttachmentexposes a way to setaddToTransactionsScreenshotAttachmentcan setaddToTransactionswhere appropriatefalse) behavior is preserved for callers that don't pass the flag