icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.7k stars 976 forks source link

zip: finish stream async when async #808

Closed piksel closed 1 year ago

piksel commented 1 year ago

This PR fixes the async finishing of entries in ZipOutputStream. The initial problem was that there was a sneaky base.Finish() call in WriteEntryFooter which in turn wrote synchronously to the output stream when called. Additionally, DeflateOutputSteam.AsyncDispose was not included when targeting .NET 6 due to the preprocessor constants for NETSTANDARD2_1_OR_GREATER not being defined.

This also adds tests that ensures that writing zip streams can be done wholly async, without calling any of the output streams synchronous methods.

Fixes #801

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

codecov[bot] commented 1 year ago

Codecov Report

Merging #808 (759570e) into master (cdd0931) will increase coverage by 0.05%. The diff coverage is 93.33%.

@@            Coverage Diff             @@
##           master     #808      +/-   ##
==========================================
+ Coverage   74.72%   74.77%   +0.05%     
==========================================
  Files          72       72              
  Lines        8485     8501      +16     
==========================================
+ Hits         6340     6357      +17     
+ Misses       2145     2144       -1     
Impacted Files Coverage Δ
...ib/Zip/Compression/Streams/DeflaterOutputStream.cs 82.72% <ø> (+1.72%) :arrow_up:
src/ICSharpCode.SharpZipLib/Zip/ZipOutputStream.cs 88.57% <93.33%> (+0.70%) :arrow_up:
src/ICSharpCode.SharpZipLib/Zip/ZipInputStream.cs 82.87% <0.00%> (-0.16%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.