-
Notifications
You must be signed in to change notification settings - Fork 1k
Bug: ZipFile does not release Handle on File #60
Copy link
Copy link
Closed
Labels
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.
Reactions are currently unavailable