I am downloading a file using HTTP and then processing it and saving parts of it to e CosmosDB, the code runs fine in VS2017 but after testing in VS2019 I am getting out of memory exceptions and I cannot figure out why.
The code is fairly simple as follows:
 MemoryStream originalFileStream = new MemoryStream(content);
 using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
 {
    MemoryStream decompressedFileStream = new MemoryStream();
    decompressionStream.CopyTo(decompressedFileStream);
    byte[] fileResult = new byte[decompressedFileStream.Length];
    decompressedFileStream.Position = 0;
    decompressedFileStream.Read(fileResult, 0, fileResult.Length);
    string result = System.Text.Encoding.UTF8.GetString(fileResult);
}
The out of memory error happens in the CopyTo() operation, but since the exact same code works in VS2017 I am a bit stuck as how to fix this in VS2019
How can this be sorted out in VS2019?
