diff --git a/docs/platforms/dotnet/common/enriching-events/attachments/index.mdx b/docs/platforms/dotnet/common/enriching-events/attachments/index.mdx index aec92bf591bff5..46df1b203ae2fa 100644 --- a/docs/platforms/dotnet/common/enriching-events/attachments/index.mdx +++ b/docs/platforms/dotnet/common/enriching-events/attachments/index.mdx @@ -77,6 +77,12 @@ Attachments are retained for 30 or 90 days, based on [your plan's data retention Learn more about how attachments impact your [quota](/pricing/quotas/). +### Sending Attachments with Transactions + +By default, scope attachments are only sent with error events, not with transactions. To also send an attachment with transactions, set `addToTransactions` to `true` when you create the `SentryAttachment`, then add it to the scope: + + + ### Access to Attachments To limit access to attachments, navigate to your organization's **General Settings**, then select the _Attachments Access_ dropdown to set appropriate access — any member of your organization, the organization billing owner, member, admin, manager, or owner. diff --git a/platform-includes/enriching-events/attachment-add-to-transactions/dotnet.mdx b/platform-includes/enriching-events/attachment-add-to-transactions/dotnet.mdx new file mode 100644 index 00000000000000..b5892dfc7f5b01 --- /dev/null +++ b/platform-includes/enriching-events/attachment-add-to-transactions/dotnet.mdx @@ -0,0 +1,26 @@ +```csharp +// Create an attachment that is also sent with transactions +var attachment = new SentryAttachment( + AttachmentType.Default, + new FileAttachmentContent("your/path/file.log"), + fileName: "file.log", + contentType: null, + addToTransactions: true); + +// Add it to the scope - it's now sent with both events and transactions +SentrySdk.ConfigureScope(scope => scope.AddAttachment(attachment)); +``` + +```fsharp +// Create an attachment that is also sent with transactions +let attachment = + SentryAttachment( + AttachmentType.Default, + FileAttachmentContent("your/path/file.log"), + "file.log", + null, + addToTransactions = true) + +// Add it to the scope - it's now sent with both events and transactions +SentrySdk.ConfigureScope(fun scope -> scope.AddAttachment(attachment)) +```