[
  {
    "Id": "125478",
    "ThreadId": "37837",
    "Html": "When I try the following code, I get an exception:<br>\r\n<br>\r\nDim zip As New Ionic.Utils.Zip.ZipFile()<br>\r\nDim entry1 As Ionic.Utils.Zip.ZipEntry = zip.AddFile(&quot;c:\\test1.txt&quot;)<br>\r\nzip.AddFile(&quot;c:\\test2.txt&quot;)<br>\r\nzip.AddFile(&quot;c:\\test3.txt&quot;)<br>\r\nzip.Save(&quot;c:\\test.zip&quot;)<br>\r\nzip.RemoveEntry(entry1) '&lt;-- This throws &quot;Object reference not set to an instance of an object.&quot; but entry1 is not nothing<br>\r\nzip.RemoveEntry(&quot;c:\\test1.txt&quot;) '&lt;-- this throws &quot;The entry you specified was not found in the zip archive.&quot; even though the code above shows it is in there<br>\r\n<br>\r\nI'm using 1.6.3.7.<br>\r\n<br>\r\nAny ideas?<br>\r\n<br>\r\n",
    "PostedDate": "2008-10-15T20:14:19.72-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125480",
    "ThreadId": "37837",
    "Html": "Let me look.\r\n",
    "PostedDate": "2008-10-15T20:29:14.657-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125495",
    "ThreadId": "37837",
    "Html": "Bug.&nbsp; The entry1 goes stale across the Save().&nbsp; I filed a workitem (6442), and fixed it.&nbsp;<br>\r\nI also updated the v1.6 release downloads with new binaries that include this fix (v1.6.3.8).&nbsp;<br>\r\n&nbsp;<br>\r\nps: I forgot to say: <br>\r\nWith this fix, after you call RemoteEntry(entry1), <br>\r\nthe succeeding call to RemoveEntry(&quot;C:\\test1.txt&quot;) will fail, because that entry is gone.<br>\r\n<br>\r\nyou can remove an entry only once.<br>\r\n",
    "PostedDate": "2008-10-15T22:29:46.507-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125505",
    "ThreadId": "37837",
    "Html": "Wow, you are fast!<br>\r\n<br>\r\nI have the same problem even if Save() is not called. Remove that line and try the rest of the code, you should see it then.<br>\r\n<br>\r\nP.S. The original code where I am removing the same file twice was simply to show that either attempt will fail. I don't expect to be able to delete a deleted entry. :-)<br>\r\n<br>\r\n",
    "PostedDate": "2008-10-15T23:09:16.46-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125626",
    "ThreadId": "37837",
    "Html": "<p>Hmmm, You cannot extract if you don't call Save().<br>\r\nI have to think about the Remove() if you don't call save.&nbsp;&nbsp;<br>\r\nLet me look. </p>\r\n<p>This code <b>does not throw</b> for me, using 1.6.3.8</p>\r\n<pre>            Dim zip As New Ionic.Utils.Zip.ZipFile()\r\n            Dim entry1 As Ionic.Utils.Zip.ZipEntry = zip.AddFile(&quot;file1.txt&quot;)\r\n            zip.AddFile(&quot;file2.txt&quot;)\r\n            zip.AddFile(&quot;file3.txt&quot;)\r\n            ' zip.Save(ZipToCreate)\r\n            zip.RemoveEntry(entry1)\r\n</pre>\r\n<p>Is that what you mean? </p>\r\n",
    "PostedDate": "2008-10-16T09:06:38.66-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125629",
    "ThreadId": "37837",
    "Html": "OK, let me try to describe more about what I'm doing.<br>\r\n<br>\r\nI want to add several files, save (so I can get the compressed file size), then I want to delete one or more files from the zip archive (and re-save to get the new compressed size). Right now, it seems like I have to create a new ZipFile and re-add all files except those I wanted to remove.<br>\r\n<br>\r\nI have not even gotten to the extraction part, yet. As I understand, the DeleteEntry method will delete an entry from the archive but will not extract that file anywhere.<br>\r\n<br>\r\nMy point is that the DeleteEntry causes problems whether or not you first call Save (since you said the Save method was invalidating object references to entries).<br>\r\n<br>\r\nAm I misunderstanding something or is there really a bug trying to delete files you have added to an archive?<br>\r\n",
    "PostedDate": "2008-10-16T09:19:14.473-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125638",
    "ThreadId": "37837",
    "Html": "<p>can you show me the code?<br>\r\nThe code I showed you - it seems to do what you described.&nbsp; <br>\r\nIt works for me. (using v1.6.3.8)<br>\r\nDoes it work for you? </p>\r\n<pre>            Dim zip As New Ionic.Utils.Zip.ZipFile()\r\n            Dim entry1 As Ionic.Utils.Zip.ZipEntry = zip.AddFile(&quot;file1.txt&quot;)\r\n            zip.AddFile(&quot;file2.txt&quot;)\r\n            zip.AddFile(&quot;file3.txt&quot;)\r\n            zip.Save(ZipToCreate)\r\n\r\n            ListFiles()\r\n\r\n            zip.RemoveEntry(&quot;c:\\file1.txt&quot;)\r\n            zip.Save(ZipToCreate)\r\n\r\n            ListFiles()\r\n\r\n</pre>\r\n<p>The above code snippet&nbsp;works for me.&nbsp; What do you get when you compile and run this? </p>\r\n",
    "PostedDate": "2008-10-16T09:35:38.217-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "125753",
    "ThreadId": "37837",
    "Html": "I just tested it with 1.6.3.9 and the code works great now. Thanks!<br>\r\n",
    "PostedDate": "2008-10-16T20:07:30.95-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]