From fb2f94b87ac94bc2f1e9e7b08892b20bda3ca25b Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 12 Jun 2025 15:20:14 +1200 Subject: [PATCH 1/2] fix: InvalidOperationException when sending attachments on Android with LLVM enabled Resolves #3101: - https://github.com/getsentry/sentry-dotnet/issues/3101 Also see: - CA2022: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2022 - CA1835: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1835 --- src/Sentry/Internal/PartialStream.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Sentry/Internal/PartialStream.cs b/src/Sentry/Internal/PartialStream.cs index be373259d6..02b2306758 100644 --- a/src/Sentry/Internal/PartialStream.cs +++ b/src/Sentry/Internal/PartialStream.cs @@ -60,7 +60,8 @@ public override async Task ReadAsync(byte[] buffer, int offset, int count, _innerStream.Position = innerPosition; } - var read = await _innerStream.ReadAsync(buffer, offset, actualCount, cancellationToken) + // See https://github.com/getsentry/sentry-dotnet/issues/3101 + var read = await _innerStream.ReadAsync(buffer.AsMemory(offset, actualCount), cancellationToken) .ConfigureAwait(false); if (_length != null) From 12a0664f617bb051032a12d1751c1991c1f7b55a Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 12 Jun 2025 15:21:47 +1200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2098284e3..3570b4de4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Fixes - The HTTP instrumentation uses the span created for the outgoing request in the sentry-trace header, fixing the parent-child relationship between client and server ([#4264](https://github.com/getsentry/sentry-dotnet/pull/4264)) +- InvalidOperationException sending attachments on Android with LLVM enabled ([#4276](https://github.com/getsentry/sentry-dotnet/pull/4276)) ### Dependencies