title: What's wrong with my application ---- Size was 0, but I expected 46806 !
body: <p>I'm a C# programmer.</p>
  
  <p>Now, I'm using the <strong>ICSharpCode.SharpZipLib.dll</strong> to create a zip file in my current project. But it occurs to me that when I click the button at the <strong>SECOND TIME</strong> to execute a function to create a zip file, the application will throw an exception, friendly and seriously told me that "Size was zero, but I expected 46086".</p>
  
  <p>I'm so confused that I want to know why? When I click the button at the first time, I can do it successfully without any error.</p>
  
  <p>My related codes are as follows:</p>
  
  <pre><code>internal void ThreadProc()
  {
      try
      {
          ZipHelper.CreateZip(backupZipFile, Constants.HomeConstant, true);
  
          // do other things
      }
  
  }
  </code></pre>
  
  <p>The CreateZip() function's realization is as follows:</p>
  
  <pre><code>public static void CreateZip(string zipFileName, string sourceDirectory, bool recurse)
  {
   FastZip zip = new FastZip();
  
   if (File.Exists(zipFileName))
   {
           File.Delete(zipFileName);
   }
  
   zip.CreateZip(zipFileName, sourceDirectory, true, "");
  }
  </code></pre>
  
  <p>Now, I will show you the recursive calling process:</p>
  
  <ol>
  <li>Call method "UpdateAppAsync" in "ActiveCheckManager" class</li>
  </ol>
  
  <blockquote>
  <pre><code>public void UpdateAppAsync(string masterConfig)
  {
      this.masterConf = masterConfig;
  
      Thread actualThread = new Thread(new ThreadStart(UpdateApp));
      actualThread.IsBackground = true;
      actualThread.CurrentCulture = Thread.CurrentThread.CurrentCulture;
      actualThread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
      actualThread.Start();
  }
  </code></pre>
  </blockquote>
  
  <ol start="2">
  <li>Call the UpdateApp function asynchronously, in the UpdateApp method, it will only call the UpdateDetail function simply.</li>
  </ol>
  
  <blockquote>
  <pre><code>private void UpdateDetail(string masterConfig, string category)
  {
      IUpdate worker = new HP.ActiveCheckLocalMode.UpdateEngine.UpdateManager();
      worker.UpdateApp(masterConf);
  }
  </code></pre>
  </blockquote>
  
  <ol start="3">
  <li>The worker.UpdateApp will call UpdateDetail(string, UpdateCategory) only.</li>
  </ol>
  
  <blockquote>
  <pre><code>private void UpdateDetail(string masterConfig, UpdateCategory cat)
  {
      UpdateThread updateThread = new UpdateThread(this, cat);
      updateThread.MasterConfig = masterConfig;
      updateThread.ThreadProc();
  }
  </code></pre>
  </blockquote>
  
  <p>That is the calling process. When I click the update button second time, it will throw an exception, can you help me? Thank you very much.</p>