This project is read-only.


File handles persist after calling Dispose() when extracting spanned ZIP


an issue when extracting spanned archives created with DotNetZip. My code is written in PowerShell.
Code to create the spanned archive:
$zipfile = new-object Ionic.Zip.ZipFile
$zipfile.UseZip64WhenSaving = [Ionic.Zip.Zip64Option]::AsNecessary
$zipfile.MaxOutputSegmentSize = $archiveSegmentSize # 40MB

Code to extract the spanned archive:
$zip = [Ionic.Zip.ZipFile]::Read($Zipfile.Fullname)
$zip.ExtractExistingFile = [Ionic.Zip.ExtractExistingFileAction]::OverwriteSilently
This will create and then extract a spanned archive with say about 5 segments. What I've noticed is that after the spanned archive is extracted, file handles to the archive segments are not closed for most of the segments after calling the Dispose() method. This means the
segment files cannot be deleted because they are still in use.
This also seems to be the case when extracting a spanned archive with the DotNetZip-WinFormsTool program.
When I tried the same code to extract a non-spanned ZIP created with DotNetZip, the file handle was closed and I could delete the ZIP file after.
Closed Jun 15, 2011 at 8:04 PM by Cheeso
this is fixed in changeset 79174. The first binary to get this fix is v1.9.1.6.


antize wrote Dec 21, 2010 at 9:47 PM

Just would like to add the comment that posted in the discussion section:

It looks like the file handles get cleaned up after a bit of time which suggests the garbage collector is doing it. So I've added this to my PowerShell code and it seems to resolve the issue for now:

wrote Jun 14, 2011 at 5:43 AM

wrote Jun 15, 2011 at 8:04 PM

wrote Feb 22, 2013 at 2:43 AM

wrote May 16, 2013 at 1:31 PM