[
  {
    "Id": "1140585",
    "ThreadId": "476817",
    "Html": "I am adding a zip file to another zip using AddEntry with a write delegate, and although many 3rd party programs can parse the resulting file, the particular app I am trying to write the zip file for cannot load the file.  Debugging through the other app, it appears as though the local file header in the resulting zip has 0 for the size of the files.  I can get it to work by saving the inner zip to a temp file first, but I would like to avoid that.<br />\n<br />\nHere are some simplified versions of the problem I am seeing.  I'm not sure if it matters, but both zip files are uncompressed.<br />\n<br />\nThis works:<br />\n<pre><code>    ZipFile output = GetOutputFile();\n    IDictionary&lt;string, ZipFile&gt; pakFiles = GetPackFiles();\n\n    foreach (var pakEntry in pakFiles)\n    {\n        var p = pakEntry.Value;\n        if (p.Count &gt; 0)\n        {\n            var tempStream = File.Open(Path.GetTempFileName(), FileMode.Open, FileAccess.ReadWrite);\n            p.Save(tempStream);\n            tempStream.Seek(0, SeekOrigin.Begin);\n            output.AddEntry(pakEntry.Key, tempStream);\n        }\n    }\n\n    output.Save(stream);</code></pre>\n\nAnd this doesn't:<br />\n<pre><code>    ZipFile output = GetOutputFile();\n    IDictionary&lt;string, ZipFile&gt; pakFiles = GetPackFiles();\n\n    foreach (var pakEntry in pakFiles)\n    {\n        var p = pakEntry.Value;\n        if (p.Count &gt; 0)\n        {\n            output.AddEntry(pakEntry.Key, (string entryName, Stream s) =&gt; { p.Save(s); });\n        }\n    }\n\n    output.Save(stream);</code></pre>\n\n",
    "PostedDate": "2013-12-21T14:06:24.817-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "1140595",
    "ThreadId": "476817",
    "Html": "To clarify, it is the local file headers in the inner zip file that are not correct.\r<br />\n<br />\nIs it possible that ZipFile.Save uses seeking within the stream to write the file sizes after writing the entry?  I believe the default stream that is used by ZipFile doesn't support seeking, so I wonder if it is just failing to seek back to update the file size in the local file header?<br />\n",
    "PostedDate": "2013-12-21T16:18:45.987-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]