title: Error while unpacking the zip from zip
body: <p>I have the following file structure:</p>
  
  <pre><code>yyyy.zip
  12x MM-yyyy.zip
  
  each of MM-yyyy.zip
              28-31x yyyyMMdd.prn
  </code></pre>
  
  <p>prn in this case is something like txt.</p>
  
  <p>I have a path to a month and extracting MM-yyyy.zip works great.
  Unfortunately, unpacking function for yyyy.zip do not want to iterate through MM-yyyy.zip and unpack them. (Error is below)</p>
  
  <p>The working for the MM-yyyy.zip</p>
  
  <pre><code>private static Dictionary&lt;string, MemoryStream&gt; UnZipToMemory(string url)
  {
      var result = new Dictionary&lt;string, MemoryStream&gt;();
      using (var client = new WebClient())
      using (ZipFile zip = ZipFile.Read(new MemoryStream(client.DownloadData(url))))
      {
          foreach (ZipEntry e in zip)
          {
              MemoryStream data = new MemoryStream();
              e.Extract(data);
              result.Add(e.FileName, data);
          }
      }
      return result;
  }
  </code></pre>
  
  <p>This function is not working for yyyy.zip</p>
  
  <pre><code>private static Dictionary&lt;string, MemoryStream&gt; UnZipToMemoryYear(string url)
  {
      var result = new Dictionary&lt;string, MemoryStream&gt;();
      using (var client = new WebClient())
      using (ZipFile zip = ZipFile.Read(new MemoryStream(client.DownloadData(url))))
      {
          foreach (ZipEntry e in zip)
          {
              MemoryStream data = new MemoryStream();
              e.Extract(data);
              using (ZipFile zi = ZipFile.Read(data))     //error is from this line
              {
                  foreach (ZipEntry f in zi)
                  {
                      MemoryStream data2 = new MemoryStream();
                      f.Extract(data2);
                      result.Add(f.FileName, data2);
                  }
              }
          }
      }
      return result;
  }
  </code></pre>
  
  <p>Thrown error ():</p>
  
  <pre><code>An unhandled exception of type 'Ionic.Zip.BadReadException' occurred in Ionic.Zip.dll
  
  Additional information: Could not read block - no data! (position 0x00000000)
  </code></pre>
  
  <p>Some data for your testing (07-2013.zip does not exist in the directory)
  If you want all possible files, look at this (<a href="http://bossa.pl/index.jsp?layout=mstock&amp;page=1&amp;news_cat_id=706&amp;dirpath=/metastock/mstock/sesjaall" rel="nofollow">http://bossa.pl/index.jsp?layout=mstock&amp;page=1&amp;news_cat_id=706&amp;dirpath=/metastock/mstock/sesjaall</a>)</p>
  
  <pre><code>    //string url = "http://bossa.pl/pub/metastock/mstock/sesjaall/07-2014.zip";
      string url = "http://bossa.pl/pub/metastock/mstock/sesjaall/2013.zip";
      //DownloadZipTest(url);
      DownloadZipTestYear(url);
  </code></pre>
  
  <p>And functions</p>
  
  <pre><code>private void DownloadZipTest(string url)
  {
  
      foreach (KeyValuePair&lt;string, MemoryStream&gt; x in UnZipToMemory(url))
      {
          Console.WriteLine("");
          Console.WriteLine(x.Key);
          Console.WriteLine(Encoding.UTF8.GetString(x.Value.ToArray()));
      }
  }
  
  private void DownloadZipTestYear(string urlYear)
  {
      foreach (KeyValuePair&lt;string, MemoryStream&gt; x in UnZipToMemoryYear(urlYear))
      {
          Console.WriteLine("");
          Console.WriteLine(x.Key);
          Console.WriteLine(Encoding.UTF8.GetString(x.Value.ToArray()));
      }
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>On dotNetZip 1.9.3 and 1.9 errors are equeal.</p>