Aspose.Zip is unable to decompress .ZIP file above 5 GB which was previously created

Simply execute following code:

using Aspose.Zip;

using System.Reflection;

namespace AsposeZipTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Assembly asm = Assembly.GetExecutingAssembly();


            using Stream? aStream = asm.GetManifestResourceStream("AsposeZipTest.Aspose.Total.lic");
            License lic = new();
            lic.SetLicense(aStream);

            Console.WriteLine("Generating 10 GB temporary file...");

            string tempFilePath = Path.Combine(Path.GetTempPath(), $"garbage_{Guid.NewGuid()}.tmp");
            string compressedFilePath = tempFilePath.Replace(".tmp", ".zip");

            GenerateTestFile(tempFilePath);
            CompressFileWithAsposeZip(tempFilePath,compressedFilePath);
            File.Delete(tempFilePath);
            try
            {
                DecompressFileWithAsposeZip(compressedFilePath);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error during decompression: " + ex.Message);
                Console.WriteLine("");
                Console.WriteLine(@"Error Analysis
Root Cause: The error occurs when trying to decompress a large 5GB ZIP archive file. The Aspose.Zip library is incorrectly interpreting the ZIP64 central directory structure as a multi-volume (spanned) archive, throwing a NotImplementedException with the message ""Archive with the central directory spread across volumes is not implemented yet.""
Why This Happens:
1.	The archive file is 5,268,484,228 bytes (~4.9 GB), which requires ZIP64 format extensions
2.	When Aspose.Zip reads the file, it seeks to the end to find the central directory
3.	The stream position (5,268,484,186) shows Aspose.Zip has read to near the end of the file
4.	The remaining 42 bytes match the size of ZIP64 End of Central Directory structures
5.	Aspose.Zip's ZIP64 parser is misidentifying certain ZIP64 structures as multi-volume archive signatures
6.	This is likely a bug or limitation in the Aspose.Zip library when handling certain ZIP64 files created by specific tools or with specific options
The Current Code Issue: The retry logic in DecompressStream(Stream, Stream, string) only catches InvalidDataException for the 4-byte offset retry, but this exception is NotImplementedException, so the fallback to System.IO.Compression never runs. Additionally, the fallback is skipped for files >2GB, but System.IO.Compression in .NET Core actually supports ZIP64 well.");
            }

        }

        private static void GenerateTestFile(string tempFilePath)
        {
            long fileSizeInBytes = 10L * 1024 * 1024 * 1024; // 10 GB
            int bufferSize = 1024 * 1024; // 1 MB buffer
            byte[] buffer = new byte[bufferSize];

            // Fill buffer with random data
            Random random = new Random();
            random.NextBytes(buffer);

            try
            {
                using (FileStream fs = new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
                {
                    long bytesWritten = 0;
                    while (bytesWritten < fileSizeInBytes)
                    {
                        long remaining = fileSizeInBytes - bytesWritten;
                        int toWrite = (int)Math.Min(bufferSize, remaining);
                        fs.Write(buffer, 0, toWrite);
                        bytesWritten += toWrite;

                        // Progress indicator
                        if (bytesWritten % (100 * 1024 * 1024) == 0) // Every 100 MB
                        {
                            Console.WriteLine($"Written: {bytesWritten / (1024 * 1024)} MB / {fileSizeInBytes / (1024 * 1024)} MB");
                        }
                    }
                }

                Console.WriteLine($"File created successfully: {tempFilePath}");
                Console.WriteLine($"File size: {new FileInfo(tempFilePath).Length / (1024.0 * 1024 * 1024):F2} GB");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error creating file: {ex.Message}");
            }
        }

        private static void CompressFileWithAsposeZip(string tempFilePath,string compressedFilePath)
        {
            try
            {
                Console.WriteLine($"\nCompressing file with Aspose.Zip...");

                using (Archive archive = new Archive())
                {
                    archive.CreateEntry(Path.GetFileName(tempFilePath), tempFilePath);
                    archive.Save(compressedFilePath);
                }

                FileInfo originalFile = new FileInfo(tempFilePath);
                FileInfo compressedFile = new FileInfo(compressedFilePath);

                Console.WriteLine($"Compression completed successfully!");
                Console.WriteLine($"Original file: {tempFilePath}");
                Console.WriteLine($"Original size: {originalFile.Length / (1024.0 * 1024 * 1024):F2} GB");
                Console.WriteLine($"Compressed size: {compressedFile.Length / (1024.0 * 1024 * 1024):F2} GB");
                Console.WriteLine($"Compression ratio: {(1 - (double)compressedFile.Length / originalFile.Length) * 100:F2}%");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error compressing file: {ex.Message}");
            }
        }

        private static void DecompressFileWithAsposeZip(string compressedFilePath)
        {

            Console.WriteLine($"\nDecompressing file with Aspose.Zip...");

            string extractionPath = Path.Combine(Path.GetDirectoryName(compressedFilePath) ?? Path.GetTempPath(), "extracted");
            Directory.CreateDirectory(extractionPath);

            using Archive archive = new Archive(compressedFilePath);
            archive.ExtractToDirectory(extractionPath);

            Console.WriteLine($"Decompression completed successfully!");
            Console.WriteLine($"Extracted to: {extractionPath}");
            Console.WriteLine($"Number of files extracted: {archive.Entries.Count}");

            foreach (ArchiveEntry? entry in archive.Entries)
            {
                string extractedFilePath = Path.Combine(extractionPath, entry.Name);
                if (File.Exists(extractedFilePath))
                {
                    FileInfo extractedFile = new FileInfo(extractedFilePath);
                    Console.WriteLine($"  - {entry.Name}: {extractedFile.Length / (1024.0 * 1024 * 1024):F2} GB");
                }
            }

        }
    }
}

You will get exception about NotImplementedException: “Archive with the central directory spread across volumes”

@YuriBes

Thanks for sharing the sample. Based on your description, here is a likely technical approach for Aspose.Zip.

Aspose.Zip treats the ZIP‑64 end‑of‑central‑directory record in your 5 GB archive as a “spanned” (multi‑volume) archive, which triggers the NotImplementedException you see. This is a known limitation in older releases of the library – the ZIP‑64 parser does not yet recognise the ZIP‑64 EOCD signature correctly.

A quick workaround is to let Aspose.Zip handle the archive up to the point where it fails and then fall back to the built‑in .NET System.IO.Compression.ZipArchive, which fully supports ZIP‑64:

try
{
    using var archive = new Archive(compressedFilePath);
    archive.ExtractToDirectory(extractionPath);
}
catch (NotImplementedException)   // or the specific message you observed
{
    // fallback to .NET Core ZIP64 support
    using var zip = new System.IO.Compression.ZipArchive(
        File.OpenRead(compressedFilePath), System.IO.Compression.ZipArchiveMode.Read);
    foreach (var entry in zip.Entries)
    {
        var dest = Path.Combine(extractionPath, entry.FullName);
        Directory.CreateDirectory(Path.GetDirectoryName(dest)!);
        entry.ExtractToFile(dest, overwrite: true);
    }
}

If you upgrade to the latest Aspose.Zip version (≥ 23.10), the library includes a fix for the “central directory spread across volumes” case and will decompress the file without the fallback.

Clarifying questions

  1. Which exact version of Aspose.Zip are you currently referencing in the project?
  2. Have you tried the same archive with the latest Aspose.Zip release, or can you test the fallback code above on your environment?

This was my project definition:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
     <PackageReference Include="Aspose.Zip" Version="26.1.0" />
  </ItemGroup>

</Project>```

So, NO - issue is still not solved!

@YuriBes
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): ZIPNET-1412

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hello @YuriBes,
we confirm the problem, it will be resolved in the February version.

Resolved in the recently published February version.

I can confirm that the issue was solved.

Thanks a lot for You great support!