-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
dotnet/android
#3578Milestone
Description
Copied from dotnet/android#3397
Steps to Reproduce
- Use the ZipArchive and ZipArchiveEntry classes to open a stream to an entry in a zip file
- Set up a GZipStream compressing to a MemoryStream
- Copy the zip entry stream to the GZipStream
- Observe the NotImplementedException
Repro project: https://github.com/mfeingol/repros/tree/master/Xamarin.Android-3397-CopyToAsync
Expected Behavior
Stream copy is successful, as it was in prior versions of the Mono runtime.
Actual Behavior
NotImplementedException:
at System.IO.Compression.DeflateStream.WriteAsyncMemory (System.ReadOnlyMemory`1[T] source, System.Threading.CancellationToken cancellationToken) [0x00000] in <ca7419b40e504a6dbe088f6fe95d09aa>:0 at (wrapper remoting-invoke-with-check) System.IO.Compression.DeflateStream.WriteAsyncMemory(System.ReadOnlyMemory`1<byte>,System.Threading.CancellationToken) at System.IO.Compression.GZipStream.WriteAsync (System.ReadOnlyMemory`1[T] buffer, System.Threading.CancellationToken cancellationToken) [0x00026] in <ca7419b40e504a6dbe088f6fe95d09aa>:0 at System.IO.Stream.CopyToAsyncInternal (System.IO.Stream destination, System.Int32 bufferSize, System.Threading.CancellationToken cancellationToken) [0x000c7] in <ff07eae8184a40a08e79049bbcb31a0e>:0 at CopyToAsync.MainPage.Repro (System.Object sender, System.EventArgs args) [0x0008a] in C:\Users\mfeingol\source\Repos\CopyToAsync\CopyToAsync\CopyToAsync\MainPage.xaml.cs:35Example code:
ZipArchive archive = new ZipArchive(ZipFile, ZipArchiveMode.Read, true, Encoding.UTF8); ZipArchiveEntry entry = archive.GetEntry("a4.jpg"); Stream src = entry.Open(); MemoryStream dest = new MemoryStream(); using (GZipStream gzip = new GZipStream(dest, CompressionLevel.Optimal, true)) await src.CopyToAsync(gzip); byte[] compressed = dest.ToArray();Version Information
VS 16.2.0, fresh project from new project wizard, latest Xamarin.Forms Nuget packages (not that it's relevant)
Log File
jwosty