This project is read-only.

Multi-Span Zips not closing after ZipFile disposal

Jun 1, 2010 at 9:49 AM
Edited Jun 1, 2010 at 9:54 AM
Hi Cheeso,
Reposting from the 'C++/CLI and "using" keyword' thread, as requested!

I'm using DotNetZip in a C++/CLI project to create encrypted and potentially multi-spanned archives, which are written to CD (hence the multi-spanning). I also have a small app that auto-launches from the first CD, collates the fragments to a directory on the recipient machine's hard-drive, requests the password and decrypts the archive, attempting to clear up the zip fragments after the extraction is complete.

I'm getting an exception when deleting the spanned zip files after extracting, with the error text as follows:
"The process cannot access the file 'xxxx.z01' because it is being used by another process."

I'm using Ionic.Zip.Reduced.dll v1.9.1.5, on WindowsXP
The code is broadly as follows:
ZipFile^ zip;
    zip = ZipFile::Read(sourcePath);
    zip->Password = password;
    zip->ExtractAll(extractPath, ExtractExistingFileAction::OverwriteSilently);
    delete zip;

catch(Exception^ ex)

Couple of notes:
1) I've used 'delete zip' rather than 'zip->~ZipFile()' as this has the same effect and is more idiomatic for C++. (I tried zip->~ZipFile() just incase, but get the same results.)
2) If the zip is a single span, it deletes just fine.
2a) To test, I took out the 'delete zip', and I then get the exception even for single span archives, as you might expect!
3) In Windows Explorer I can not delete any of the zip fragments until the extraction application exits.

So, I was wondering if the Dispose method fails to close the zip fragments when dealing with a multi-span archive?
Jun 1, 2010 at 1:56 PM

Hmmm, interesting.  The diagnosis you suggest is possible - I'll investigate.  

It would be surprising because there are test cases tht cover multi-segment archives, and I believe those tests delete the zip file after use.

It won't be hard for me to test it, though.  I'll get back to you.


Jun 1, 2010 at 4:04 PM

I've reproduced the behavior.  Will let you know. . .

Jun 1, 2010 at 4:04 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 2, 2010 at 8:08 PM
I'm testing a fix for the problem now. . .
Jun 3, 2010 at 2:47 PM

Thanks for the update, your dedication to this project does you proud!

Sep 3, 2010 at 11:51 AM

Anything new about this? I'm struggling with this as well

Sep 7, 2010 at 11:42 AM


Aug 6, 2011 at 3:03 PM

This was a problem in the v1.9.1.5 release.  It's fixed in the v1.9.1.7 release.  Try it.