IInArchive.Open shows UnsupportedMethod error

May 15, 2009 at 8:40 AM

I am really impressed by this library, however I found an unexpected problem.

An exception is getting thrown in the SevenZipExtractor.GetArchiveInfo, the _Archive.Open() COM method is returning 1 (OperationResult.UnsupportedMethod) when is is called a second time.

I added the followng code to the SevenZipTest project, which demonstrates the issue.


            #region Failed Extraction test - ExtractArchive


            using (SevenZipExtractor tmp = new SevenZipExtractor(@"e:\SevenZipSharp\SevenZipSharp.7z"))


                try { tmp.Check(); }

                catch (SevenZipArchiveException e) { Console.WriteLine("First Check Failed"); }


                try { tmp.ExtractArchive(@"e:\SevenZipSharp\tmp"); }

                catch (SevenZipArchiveException e) { Console.WriteLine("First Extract Failed"); }


                try { tmp.Check(); }

                catch (SevenZipArchiveException e) { Console.WriteLine("Second Check Failed"); }


                try { tmp.ExtractArchive(@"e:\SevenZipSharp\tmp"); }

                catch (SevenZipArchiveException e) { Console.WriteLine("Second Extract Failed"); }




Gives the following output:

SevenZipSharp test application.

First Extract Failed

Second Check Failed

Second Extract Failed

Press any key to finish.


The first call to tmp.Check() works fine, but the subsequent calls fail. If you only do one or the other, they work fine.