Free Support Forum - aspose.com

Archive Constructor: IndexOutOfRangeException

Hello. We are using the current version of Aspose.ZIP for .NET (19.12). Running under .NET framework 4.7.2.

It works on many files but in some cases it fails with an IndexOutOfRangeException when calling the constructor.

Code as follows:

new Archive(@"C:\temp\testunzip\test.zip")
            .ExtractToDirectory(@"C:\temp\testunzip\out");

Note that the failure is produced by the constructor; the call to “ExtractToDirectory” is never reached.

The ZIP file causing this issue is attached. I don’t believe that there is anything unusual about this ZIP. It is viewable and extractable by Windows Explorer.

test.zip (51.1 KB)

Error as follows:

Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at   .(Byte[] )
  at   .()
  at   .(BinaryReader )
  at   .(Int64 , UInt64 )
  at Aspose.Zip.Archive.(Stream , ArchiveLoadOptions )
  at Aspose.Zip.Archive..ctor(Stream sourceStream, ArchiveLoadOptions loadOptions, ArchiveEntrySettings newEntrySettings)
  at Aspose.Zip.Archive..ctor(String path, ArchiveLoadOptions loadOptions, ArchiveEntrySettings newEntrySettings)

@jamesaflagg

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as ZIPNET-471. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@jamesaflagg

Thanks for your patience. It is to inform you that this issue has been resolved and its fix is available in the latest version of Aspose.ZIP for .NET 20.3. So, please use Aspose.ZIP for .NET 20.3.