[
  {
    "Id": "664793",
    "ThreadId": "270757",
    "Html": "<p>Hi everyone :)</p>\n<p>Here's my snippet :</p>\n<p>&nbsp;</p>\n<div style=\"color: black; background-color: white;\">\n<pre><span style=\"color: blue;\">public</span> <span style=\"color: blue;\">void</span> WriteMyZip(Stream outputStream)\n{\n   <span style=\"color: blue;\">using</span> (<span style=\"color: blue;\">var</span> zip = <span style=\"color: blue;\">new</span> ZipFile())\n   {\n      zip.AddEntry(fileName, otherStream);\n      zip.Save(outputStream);\n   }\n}\n</pre>\n</div>\n<p>&nbsp;</p>\n<p>When i call it with a memorystream :</p>\n<p>&nbsp;</p>\n<div style=\"color: black; background-color: white;\">\n<pre>_service.WriteMyZip(<span style=\"color: blue;\">new</span> MemoryStream());\n</pre>\n</div>\n<p>&nbsp;</p>\n<p>I get the exception.</p>\n<p>What did i miss ? Are there options needed ?</p>\n<p>Thanks :)</p>\n<p>&nbsp;</p>\n<p>edit : my stacktrace</p>\n<p>&nbsp;&nbsp; at System.IO.__Error.StreamIsClosed()<br />&nbsp;&nbsp; at System.IO.MemoryStream.get_Length()<br />&nbsp;&nbsp; at Ionic.Zip.ZipEntry.SetInputAndFigureFileLength(Stream&amp; input) in c:\\DotNetZip\\Zip\\ZipEntry.Write.cs:line 1456<br />&nbsp;&nbsp; at Ionic.Zip.ZipEntry._WriteEntryData(Stream s) in c:\\DotNetZip\\Zip\\ZipEntry.Write.cs:line 1355<br />&nbsp;&nbsp; at Ionic.Zip.ZipEntry.Write(Stream s) in c:\\DotNetZip\\Zip\\ZipEntry.Write.cs:line 2182<br />&nbsp;&nbsp; at Ionic.Zip.ZipFile.Save() in c:\\DotNetZip\\Zip\\ZipFile.Save.cs:line 168<br />&nbsp;&nbsp; at Ionic.Zip.ZipFile.Save(Stream outputStream) in c:\\DotNetZip\\Zip\\ZipFile.Save.cs:line 584</p>\n<p>I can't figure out where the stream is closed :/</p>",
    "PostedDate": "2011-08-29T05:21:34.55-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "664820",
    "ThreadId": "270757",
    "Html": "<p>Allright, i figured it out : visual studio showed to me that the exception occured in the save() method. It mislead me to believe that the closed stream was the outputstream.</p>\r\n<p>In fact, it was the \"otherstream\" that was closed, it makes more sense.</p>\r\n<p>My code was crappy, that's my bad. But if you should test against this case (with an appropriate error message) that would be helpful for the other code-crapper like me ;p</p>\r\n<p>Thanks :)</p>",
    "PostedDate": "2011-08-29T06:28:02.69-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]