[
  {
    "Id": "661949",
    "ThreadId": "270047",
    "Html": "<p>Hello,</p>\n<p>whenever i am using MaxOutputSegmentSize i get an Exception (System.UnauthorizedAccessException: Access denied ...).</p>\n<p>I use the current v 1.9.1.8</p>\n<p>Ist an basic code adding a file and two folders to the archive, i reproduced the exception with different folders (Size about 400MB to 1GB with lots of smaller files).</p>\n<p>When i do not use MaxOutputSegmentSize it works, when i give MaxOutputSegmentSize an Value for 100MB the exception will allways occur when the second file (.z02) reached its max size, a third file is not created then. When i set the MaxOutputSegmentSize  to a value for 5MB there are several files and the Exception will occur later, i.e. on the end of file .z08.</p>\n<p>The directories used are local directories with all read/write rights f&uuml;r IUSR / IIS_IUSR / IIS_WPG but those rights did not change anything.</p>\n<p>The strange thing is that the first z01 file always works, the exception allways occurs on a later one.</p>\n<p>If i use zip.ZipErrorAction = ZipErrorAction.Skip or .Retry i get an System.ObjectDisposedException instead.</p>\n<p>Can anyone help me with this?</p>\n<p>&nbsp;</p>\n<pre><code><span>ZipFile</span><span> zip </span><span>=</span><span> </span><span>new</span><span> </span><span>ZipFile</span><span>(</span><span>backupPath </span><span>+</span><span> </span><span class=\"str\">\"Backup.zip\"</span><span>);</span><span><br />zip</span><span>.</span><span>MaxOutputSegmentSize</span><span> </span><span>=</span><span> maxSize</span><span>;</span><span><br /></span><span>//zip.TempFileFolder = @\"D:\\Backup\\Temp\"; //seems not to make any difference</span><span><br /><br />zip</span><span>.</span><span>Comment</span><span> </span><span>=</span><span> </span><span class=\"str\">\"Backup created at \"</span><span> </span><span>+</span><span> </span><span>System</span><span>.</span><span>DateTime</span><span>.</span><span>Now</span><span>.</span><span>ToString</span><span>(</span><span class=\"str\">\"G\"</span><span>);</span><span><br />zip</span><span>.</span><span>AddFile</span><span>(</span><span>dbBackup</span><span>.</span><span>FullName</span><span>,</span><span class=\"str\">\"Database\"</span><span>);</span><span><br />zip</span><span>.</span><span>AddDirectory</span><span>(</span><span>physicalAppPath</span><span>,</span><span class=\"str\">\"Application\"</span><span>);</span><span><br />zip</span><span>.</span><span>AddDirectory</span><span>(</span><span>mailArchivePath</span><span>,</span><span class=\"str\">\"MailArchive\"</span><span>);</span><span><br />zip</span><span>.</span><span>Save</span><span>();</span><span> </span><span>//Exception occurs here<br /><br /><br />The Stack Trace:<br /><br /></span></code><pre><code><span>bei </span><span>System</span><span>.</span><span>IO</span><span>.</span><span>__Error</span><span>.</span><span>WinIOError</span><span>(</span><span>Int32</span><span> errorCode</span><span>,</span><span> </span><span>String</span><span> maybeFullPath</span><span>)</span><span><br />bei </span><span>System</span><span>.</span><span>IO</span><span>.</span><span>File</span><span>.</span><span>Move</span><span>(</span><span>String</span><span> sourceFileName</span><span>,</span><span> </span><span>String</span><span> destFileName</span><span>)</span><span><br />bei </span><span>Ionic</span><span>.</span><span>Zip</span><span>.</span><span>ZipSegmentedStream</span><span>.</span><span>TruncateBackward</span><span>(</span><span>UInt32</span><span> diskNumber</span><span>,</span><span> </span><span>Int64</span><span> offset</span><span>)</span><span><br />bei </span><span>Ionic</span><span>.</span><span>Zip</span><span>.</span><span>ZipEntry</span><span>.</span><span>Write</span><span>(</span><span>Stream</span><span> s</span><span>)</span><span><br />bei </span><span>Ionic</span><span>.</span><span>Zip</span><span>.</span><span>ZipFile</span><span>.</span><span>Save</span><span>()</span></code><code><br />bei MyProject.Configuration.Backup.BackupLogic.Backup(Boolean monthly) in D:\\projects\\MyProject.Configuration\\Backup\\BackupLogic.cs:Zeile 100.\nbei MyProject.Configuration.Backup.BackupLogic.ScheduledBackup() in D:\\projects\\MyProject.Configuration\\Backup\\BackupLogic.cs:Zeile 42.\nbei MyProject.Configuration.BackupTimer.CreateThread(Object parameters) in D:\\projects\\MyProject.Configuration\\BackupTimer.cs:Zeile 60.\nbei System.Threading.ExecutionContext.runTryCode(Object userData)\nbei System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)\nbei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)\nbei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\nbei System.Threading.ThreadHelper.ThreadStart(Object obj)</code><br /><br /><br /><p>Exception and StackTrace for using ZipErrorAction.Skip:</p>\n<pre class=\"lang-cs prettyprint\"><code><span class=\"typ\">ObjectDisposed</span><span class=\"pln\"> </span><span class=\"typ\">Exception</span><span class=\"pln\"> was unhandled</span><span class=\"pun\">:</span><span class=\"pln\"> </span><span class=\"typ\">&nbsp;</span><span class=\"typ\">Could</span><span class=\"pln\"> not access an closed file</span><span class=\"pln\"><br /><br />bei </span><span class=\"typ\">System</span><span class=\"pun\">.</span><span class=\"pln\">IO</span><span class=\"pun\">.</span><span class=\"typ\">FileStream</span><span class=\"pun\">.</span><span class=\"pln\">get_Position</span><span class=\"pun\">()</span><span class=\"pln\"><br />bei </span><span class=\"typ\">Ionic</span><span class=\"pun\">.</span><span class=\"typ\">Zip</span><span class=\"pun\">.</span><span class=\"typ\">ZipEntry</span><span class=\"pun\">.</span><span class=\"typ\">Write</span><span class=\"pun\">(</span><span class=\"typ\">Stream</span><span class=\"pln\"> s</span><span class=\"pun\">)</span><span class=\"pln\"><br />bei </span><span class=\"typ\">Ionic</span><span class=\"pun\">.</span><span class=\"typ\">Zip</span><span class=\"pun\">.</span><span class=\"typ\">ZipFile</span><span class=\"pun\">.</span><span class=\"typ\">Save</span><span class=\"pun\">()</span><span class=\"pln\"><br /></span><span class=\"pun\">...</span><span class=\"pln\"><br /></span></code></pre>\n<br /><code><span><br /><br /><br /></span><span>&nbsp;</span></code></pre>\n<br /><code><span><br /></span></code></pre>",
    "PostedDate": "2011-08-23T01:07:11.487-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "662654",
    "ThreadId": "270047",
    "Html": "<p>The Problem was that there are gzip files (.gz with password) in one Folder - it seems that DotNetZip can not split those (7zip can).</p>\r\n<p>So as soon as it reaches the end of a .zip file filled with those gzip files the exception occurs.</p>\r\n<p>I used now a workaround so i cycle all my files, calc the total size and create single (not splitted) zip files each time i reach my max size - the Problem (Bug?) for DotNetZip remains.</p>",
    "PostedDate": "2011-08-24T06:40:59.557-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "662753",
    "ThreadId": "270047",
    "Html": "<p>Hmmm, this is unfortunate.&nbsp; It does seem like there's still bug in the segmented archive stuff. I'll need a way to reproduce it . I went through lots of testing trying to make sure that the segmented stuff works well.&nbsp; I don't see errors.&nbsp; If you could package up a small testcase that reliably reproduces the problem, I'll get to work on it.</p>",
    "PostedDate": "2011-08-24T09:27:15.007-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]