For deployment packages we use DotNetZip Library to create zip files. One of the files recently became corrupted when put in the package.
We investigated the changing of Compression Level and Compression Method. Which solved the issue but none were acceptable. See details in table below.
After finding more discussion on the issue (ZipFile.AddFile fails depending of the file size) We noted the file size was 1048576, which is 128 * 8 * 1024 and fits the problem with the parallel deflate compression method. The solution is to not use parallelism.
zip.ParallelDeflateThreshold = -1;
This dropped the performance to 41 sec, but that was acceptable.
Deflate level 0 | Deflate (issue) | No parallel | BZip2 |
3 sec | 19 sec | 41 sec | 71 sec |
292 Mb | 110 Mb | 110 Mb | 96 Mb |