This project is read-only.

Bug when compressing .rar or .zip file

Aug 24, 2010 at 11:02 AM


I found a bug, when compressing(actually archiving) a .rar or .zip file into segments, particularly if the file is large enough to generate more than one segment, DotNetZip will throw a "FileNotFoundException", saying that the XXX.z01 doesn't exists.  From the code, it seems the method WantReadAgain(file: ZipEntry.Writer.cs) returns true if compressed size is larger than original size, and that will direct to method "TruncateBackward" (file: ZipSegmentedStream.cs) which generates the exception.

the exception is thrown from the following code:

// get a new temp file, try 3 times:
            for (int i = 0; i < 3; i++)
                    _currentTempName = SharedUtilities.InternalGetTempFileName();
                    File.Move(CurrentName, _currentTempName);  // move the .z0x file back to a temp name
                    if (i == 2) throw;


Aug 26, 2010 at 12:40 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.