Ionic.Zip (DotNetZip) hangs with in save method with IO.MemoryStream

Jan picture Jan · Jan 16, 2011 · Viewed 7.3k times · Source

I'll try to create an zip file with the DotNetZip-Libary with 106 Images (675MB) with the following code:

Public Function GetZip() As Byte()
    Dim zip As New Ionic.Zip.ZipFile(String.Format("{0}.zip", Me.GallerySystemName))
    AddHandler zip.SaveProgress, AddressOf SaveProgress

    For Each img In Me.Images
        zip.AddFile(img.OriginalFile.FullName, "")
    Next

    Dim bytZip As Byte()

    Using ms As New MemoryStream
        zip.Save(ms)
        bytZip = ms.ToArray
    End Using

    Return bytZip
End Function

When I run this code, the execution stops usally at image 40 (sometimes earlier) without any exeption. Nothing happens. I tried to save the zip directly to a file. It works.

Any ideas?

Jan

Answer

Nitin S picture Nitin S · Feb 25, 2014

SET the zip object property ParallelDeflateThreshold to -1 just before saving the zip file

zip.ParallelDeflateThreshold = -1



REF: http://forums.codeguru.com/showthread.php?534177-Issue-with-DotNetZip-ionic.zip-class-hanging-on-save