icsharpcode/SharpZipLib

ZipOutputStream calls sync DeflaterOutputStream.Finish from async

Christianschrodahl opened this issue · 1 comments

Steps to reproduce

  1. Create http get request.
  2. set AllowSynchronousIO to false
  3. Start zip json data and pdf docs
  4. Only use async methods to run the code.

Expected behavior

Return a zipped file

Actual behavior

You can se it crash on PutNextEntryAsync and/or finnishAsync.
Looks like PutNextEntryAsync calls Finish() and not FinnishAsync()

Exception:

Exception has occurred: CLR/System.InvalidOperationException
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll: 'Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead.'

image

Version of SharpZipLib

1.4.1

Obtained from (only keep the relevant lines)

  • Package installed using NuGet

Yeah, this is caused by the following line:

It shouldn't be called inside WriteEntryFooter, but rather in the CloseEntry(Async) methods.