Skip to content

Commit

Permalink
Make GzipRequestBodyHandler respect async (#1776)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Jul 14, 2022
1 parent ca9e92e commit 6728fdb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
@RenderSection("Scripts", required: false)
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
10 changes: 5 additions & 5 deletions src/Sentry/Internal/Http/GzipRequestBodyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6728fdb

Please sign in to comment.