question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NotSupportedException for 7zip Archive using Ultra Compression

See original GitHub issue

I zipped up a file using 7zip (file manager / GUI). I tried with both LZMA and LZMA2, using ultra compression. I can’t seem to figure out how to extract it; I always get a NotSupportedException.

Here are the two snippets I tried with the archiving API, which supposedly works?

                // 1) Archive API? not supported exception.
                var archive = ArchiveFactory.Open(archivePath);
                archive.WriteToDirectory(outPath, options);

                // 2) Archive API: not supported exception
                var archive = ArchiveFactory.Open(archivePath);
                foreach (var entry in archive.Entries.Where(e => !e.IsDirectory))
                {
                    entry.WriteToDirectory(outPath, options);
                }

I think they fail with the same exception. Here’s the stack trace for the second one:

Exception has occurred: CLR/System.NotSupportedException
An unhandled exception of type 'System.NotSupportedException' occurred in SharpCompress.dll: 'Specified method is not supported.'
   at SharpCompress.Compressors.LZMA.DecoderRegistry.CreateDecoderStream(CMethodId id, Stream[] inStreams, Byte[] info, IPasswordProvider pass, Int64 limit)
   at SharpCompress.Compressors.LZMA.DecoderStreamHelper.CreateDecoderStream(Stream inStream, Int64 startPos, Int64[] packSizes, CFolder folderInfo, IPasswordProvider pass)
   at SharpCompress.Common.SevenZip.ArchiveDatabase.GetFolderStream(Stream stream, CFolder folder, IPasswordProvider pw)
   at SharpCompress.Common.SevenZip.SevenZipFilePart.GetCompressedStream()
   at SharpCompress.Archives.SevenZip.SevenZipArchiveEntry.OpenEntryStream()
   at SharpCompress.Archives.IArchiveEntryExtensions.WriteTo(IArchiveEntry archiveEntry, Stream streamToWriteTo)
   at SharpCompress.Archives.IArchiveEntryExtensions.<>c__DisplayClass2_0.<WriteToFile>b__0(String x, FileMode fm)
   at SharpCompress.Common.ExtractionMethods.WriteEntryToFile(IEntry entry, String destinationFileName, ExtractionOptions options, Action`2 openAndWrite)
   at SharpCompress.Archives.IArchiveEntryExtensions.WriteToFile(IArchiveEntry entry, String destinationFileName, ExtractionOptions options)
   at SharpCompress.Common.ExtractionMethods.WriteEntryToDirectory(IEntry entry, String destinationDirectory, ExtractionOptions options, Action`2 write)
   at SharpCompress.Archives.IArchiveEntryExtensions.WriteToDirectory(IArchiveEntry entry, String destinationDirectory, ExtractionOptions options)

I’m sure it must be something I’m doing wrong (perhaps in my 7zip archive creation?) but I can’t figure out what or how to make this work.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
TraceEntertainscommented, Feb 19, 2023

@TraceEntertains , I would like to know if you have a test file that fails with the pull request I created. the current test contains the general setup of files used in the test suite and that passed.

Both my delta test file and the original archive it was based on extracted seemingly perfectly, and the music files were the quickest to extract out of almost all other files that I could tell.

0reactions
adamhathcockcommented, Mar 1, 2023

Thanks Erior. I’ve been away for personal reasons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

7zip Ultra LZMA2 compression - batch file
I'm not sure as of which 7z version it barfs on -d=1024m , but this works for version 16.04 on Windows: 7z.exe a...
Read more >
ZipFile.CreateFromDirectory Method
Creates a zip archive that contains the files and directories from the specified directory, uses the specified compression level, and optionally includes ...
Read more >
What is the best configuration to 7zip for maximum ...
I've been using 7zip for a while now, I'd like your feedback on what the best settings would be for a maximum compression...
Read more >
What compression options does 7Zip use when you add ...
To change the compression scheme, 1. Unpack all files in the archive. 2. Select all in 7-Zip. 3. Add to a new compressed...
Read more >
How to recover corrupted 7z archive
How to recover corrupted 7z archive. Try latest version of 7-Zip. It's possible that new version of 7-Zip can solve your problems with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found