diff --git a/CHANGELOG.md b/CHANGELOG.md index a176664d69..bfd2e5aa7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fix error with `ConcurrentHashMap` on Android <= 9 ([#1761](https://github.com/getsentry/sentry-dotnet/pull/1761)) - Minor improvements to `BackgroundWorker` ([#1773](https://github.com/getsentry/sentry-dotnet/pull/1773)) +- Make GzipRequestBodyHandler respect async ([#1776](https://github.com/getsentry/sentry-dotnet/pull/1776)) ## 3.19.0 diff --git a/samples/Sentry.Samples.AspNetCore5.Mvc/Views/Shared/_Layout.cshtml b/samples/Sentry.Samples.AspNetCore5.Mvc/Views/Shared/_Layout.cshtml index 4ebed56664..1bfa98e53c 100644 --- a/samples/Sentry.Samples.AspNetCore5.Mvc/Views/Shared/_Layout.cshtml +++ b/samples/Sentry.Samples.AspNetCore5.Mvc/Views/Shared/_Layout.cshtml @@ -43,6 +43,6 @@ - @RenderSection("Scripts", required: false) + @await RenderSectionAsync("Scripts", required: false) diff --git a/src/Sentry/Internal/Http/GzipRequestBodyHandler.cs b/src/Sentry/Internal/Http/GzipRequestBodyHandler.cs index 14d167e2dc..002adf3c17 100644 --- a/src/Sentry/Internal/Http/GzipRequestBodyHandler.cs +++ b/src/Sentry/Internal/Http/GzipRequestBodyHandler.cs @@ -82,14 +82,14 @@ protected override bool TryComputeLength(out long length) protected override async Task SerializeToStreamAsync(Stream stream, TransportContext? context) { var gzipStream = new GZipStream(stream, _compressionLevel, leaveOpen: true); - try +#if NET461 || NETSTANDARD2_0 + using (gzipStream) +#else + await using (gzipStream.ConfigureAwait(false)) +#endif { await _content.CopyToAsync(gzipStream).ConfigureAwait(false); } - finally - { - gzipStream.Dispose(); - } } } } diff --git a/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs b/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs index 0df05420d6..1edf196afc 100644 --- a/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs +++ b/test/Sentry.DiagnosticSource.Tests/Integration/SQLite/SentryDiagnosticListenerTests.cs @@ -131,6 +131,10 @@ public async Task EfCoreIntegration_RunAsyncQuery_TransactionWithSpansWithOneCom commands.Add(i * 2); } // Save before the Transaction creation to avoid storing junk. + //Dont async here since it will fail in mac+linux with + // The type initializer for 'System.Data.Common.DbConnectionExtensions' threw an exception. + // Expression of type 'ValueTask[System.Data.Common.DbTransaction]' cannot be used... + // ReSharper disable once MethodHasAsyncOverload context.SaveChanges(); var hub = _fixture.Hub;