This project is read-only.

Saving zip to more than one stream

Aug 30, 2011 at 10:09 AM


I have encountered an error during second call to Save(stream) method. Here is an example:

ZipFile zip = new ZipFile();
// add some files

// Save to first stream
MemoryStream ms1 = new MemoryStream();

// Try to save to another stream
MemoryStream ms2 = new MemoryStream();
// here exception is thrown

The exception is of ZipException type with "Cannot read that as a ZipFile" message and with inner exception of NullReferenceException type with "Object reference not set to an instance of an object." message.

Generaly, I want to check zip size after adding each file. So I save zip to memory stream and check its length. This IMO is more elegant solution than saving to temporary files. Or perhaps, there is another way to check zip size?



Sep 2, 2011 at 3:42 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.