[
  {
    "Id": "276611",
    "ThreadId": "80661",
    "Html": "<p>I have a method</p>\r\n<p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre> <span style=\"color:Blue\">private</span> <span style=\"color:Blue\">void</span> SaveOutputFile(<span style=\"color:Blue\">string</span> targetFile, ZipFile sourceZipFile)<br>        {<br>            <span style=\"color:Blue\">try</span>\r\n            {\r\n                <span style=\"color:Blue\">string</span> strZipFolder = Path.GetDirectoryName(sourceZipFile.Name);<br>                <span style=\"color:Blue\">string</span> strInfoXmlFile = <span style=\"color:#A31515\">&quot;info.xml&quot;</span>;<br>                XmlDocument objXmlDoc = GetJobXml(objJobInfoXml);<br>                <span style=\"color:Green\"><span style=\"color:#000000\">sourceZipFile.AddEntry(strInfoXmlFile, objXmlDoc.InnerXml);  </span>        </span>\r\n                sourceZipFile.Save(targetFile);               \r\n            }\r\n            <span style=\"color:Blue\">catch</span> (Exception ex)<br>            {<br>                <span style=\"color:Blue\">throw</span> ex;<br>            }<br>        }<br></pre>\r\n</div>\r\n</p>\r\n<p>In which I am adding a File to an Entry in an existing Zipfile then Saving the Zipfile into a new location</p>\r\n<p>But for one zipfile i am getting this error &quot;Cannot access a closed file.&quot;</p>\r\n<p>Even without adding a new entry I am getting same error for a particular zip file.</p>\r\n<p>Please let me know what I amy be doing wrong.</p>",
    "PostedDate": "2010-01-13T02:32:32.12-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "276612",
    "ThreadId": "80661",
    "Html": "<p>Message = <span>Cannot access a closed file</span></p>\r\n<p>Source = mscorlib</p>\r\n<p>Full Stack Trace is</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>   at System.IO.__Error.FileNotOpen()\r\n   at System.IO.FileStream.Seek(Int64 offset, SeekOrigin origin)\r\n   at Ionic.Zip.CountingStream.Seek(Int64 offset, SeekOrigin origin)\r\n   at Ionic.Zip.ZipEntry.CopyThroughWithNoChange(Stream outstream)\r\n   at Ionic.Zip.ZipEntry.CopyThroughOneEntry(Stream outstream)\r\n   at Ionic.Zip.ZipEntry.Write(Stream s)\r\n   at Ionic.Zip.ZipFile.Save()\r\n   at Ionic.Zip.ZipFile.Save(String fileName)\r\n   at BO.Level1Validator.SaveOutputFile(String targetFile, ZipFile sourceZipFile) <span style=\"color:Blue\">in</span> C:\\MyProject\\LevelValidator.cs:line 799\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>\r\n<p>It is looks like a error close to</p>\r\n<p><a href=\"http://community.sharpdevelop.net/forums/p/6881/19716.aspx\">http://community.sharpdevelop.net/forums/p/6881/19716.aspx</a></p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-01-13T02:33:38.617-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "276780",
    "ThreadId": "80661",
    "Html": "<p>The error you're getting has nothing to do with an error in SharpZipLib.&nbsp;</p>\r\n<p>They are different implementations.&nbsp; Any similarities are coincidental.</p>\r\n<p>The stack trace indicates that you are trying to update a zipfile.&nbsp; At least one of the entries in the existing zip file is unchanged. DotNetZip will copy through the metadata+data for each unchanged zip entry, from the source to the target zip file.</p>\r\n<p>To do this, DotNetZip needs to seek within the original (source) Zip file, to the location of the original entry.&nbsp; It then does a read/write copy loop.&nbsp; But the Seek is failing because the original, source zip file is closed.</p>\r\n<p>I don't kniow why that would be the case.&nbsp; I'd like to see more of your code - for example, how do you instantiate the ZipFile object, before passing it to the method you included above?</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-01-13T10:39:56.46-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]