Skip to content

Bug: ZipFile does not release Handle on File #60

@ghost

Description

When modifying a Filestream the zipFile keeps a handle after closing. The following code results in a System.IO.Exception when File.Delete is executed:

    using (FileStream msZip = File.Open("FILELOCATION", FileMode.Open)) {
      using (ZipFile zipFile = new ZipFile(msZip)) {
      zipFile.IsStreamOwner = false;

      zipFile.BeginUpdate();
      // DO SOMETHING

      // commit and close
      zipFile.CommitUpdate();
      zipFile.Close();
      }
      msZip.Close();
    }
    File.Delete("FILELOCATION");

A temporary fix is setting the zipFile.IsStreamOwner = true, which will actually release the file handle.

Metadata

Metadata

Assignees

Labels

bugzipRelated to ZIP file format

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions