diff --git a/tracer/src/Datadog.Trace/Debugger/Upload/SymbolUploadApi.cs b/tracer/src/Datadog.Trace/Debugger/Upload/SymbolUploadApi.cs index b1d289a46951..dc1fe6c97ee6 100644 --- a/tracer/src/Datadog.Trace/Debugger/Upload/SymbolUploadApi.cs +++ b/tracer/src/Datadog.Trace/Debugger/Upload/SymbolUploadApi.cs @@ -84,24 +84,24 @@ public override async Task SendBatchAsync(ArraySegment symbols) MultipartFormItem symbolsItem; - if (_enableCompression) + if (!this._enableCompression) + { + symbolsItem = new MultipartFormItem("file", MimeTypes.Json, "file.json", symbols); + } + else { using var memoryStream = new MemoryStream(); #if NETFRAMEWORK - using var gzipStream = new Vendors.ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memoryStream); - await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false); - await gzipStream.FlushAsync().ConfigureAwait(false); + using (var gzipStream = new Vendors.ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memoryStream)) #else - using var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress); - await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false); - await gzipStream.FlushAsync().ConfigureAwait(false); + using (var gzipStream = new GZipStream(memoryStream, CompressionMode.Compress)) #endif + { + await gzipStream.WriteAsync(symbols.Array, 0, symbols.Array.Length).ConfigureAwait(false); + } + symbolsItem = new MultipartFormItem("file", MimeTypes.Gzip, "file.gz", new ArraySegment(memoryStream.ToArray())); } - else - { - symbolsItem = new MultipartFormItem("file", MimeTypes.Json, "file.json", symbols); - } var items = new[] { symbolsItem, new MultipartFormItem("event", MimeTypes.Json, "event.json", _eventMetadata) };