0

When I try to read the files contained in a large zip file (expands to 3.9GB) using ZipArchive, I get an InvalidDataException exception "The archive entry was compressed using an unsupported compression method" on the StreamReader line.

using (ZipArchive archive = ZipFile.OpenRead(zippedFileName))
{
    foreach (ZipArchiveEntry entry in archive.Entries)
    {
        using (StreamReader sr = new StreamReader(entry.Open()))
        {
            ...
        }
    }
}

The same code works file for a 600M (extracted) zip file.

Is there a way to get this to work?

HandyHowie
  • 231
  • 2
  • 6
  • I'm guessing it's Zip64, 3rd party libraries like DotNetZip support it, but it's probably not supported by the ZipArchive class – Martheen Aug 31 '17 at 10:19
  • @Martheen Thanks. I will look into DotNetZip. – HandyHowie Aug 31 '17 at 11:12
  • This *might* be an issue with .NET memory (just a guess), try setting `gcAllowVeryLargeObjects` in app.config. See https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/gcallowverylargeobjects-element for details. – BurnsBA Aug 31 '17 at 13:38
  • @BurnsBA Thanks for the suggestion, I will give it a try and let you know if it works. – HandyHowie Aug 31 '17 at 13:41
  • @BurnsBA I added to the app.config file, but it didn't help. – HandyHowie Sep 01 '17 at 08:51

0 Answers0