mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
System.NotSupportedException on reader.MoveToNextEntry() #465
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Stuart88 on GitHub (Jun 27, 2021).
Unzipping a 7z file fails with
System.NotSupportedExceptionon the lastMoveToNextEntry()call.On inspecting the results in file explorer, I can see it's successfully finished extraction, so I guess
MoveToNextEntry()is hitting an error of some kind instead of discovering that it's at the end of the archive?.If it helps, the 7z archive I'm working with can be downloaded here: https://www.nexusmods.com/oblivion/mods/5296?tab=files&file_id=1000024710
Stack Trace:
Thanks :)
@DMW007 commented on GitHub (Jan 7, 2022):
If you're extracting using the
ReaderFactory, it seems that 7z support is missing there. As an workaround, you can try open it manually withSevenZipArchive.Open().But the progress seems not to work using this wayand self-writing a wrapper doesn't work because theRewindableStreamclass is mostly declared as internal.You can use the event when calling
ExtractAllEntries()on the archive like this:Extracting other formats with the auto-detection of the
ReaderFactoryclass can still be used. Until this is fixed, you just need to check yourself first if the archive is a 7z archive and extract it manually, otherwise useReaderFactorylike this:It's a bit more manual work, but it works and both allow to show the correct progress (usefull on larger files and/or slower machines/disks).
@adamhathcock commented on GitHub (Jan 9, 2022):
Thanks for helping @DMW007
Readers aren't used with 7Zip because 7Zip requires random access on the stream. Reader is built for non-seekable streams while Archive is built for seekable streams.
@DMW007 commented on GitHub (Jan 9, 2022):
Thank you @adamhathcock for the explanation. I'd suggest to document this in the usage guide, so it's clear that the auto extractor cannot work with 7zip archives.
@adamhathcock commented on GitHub (Jan 10, 2022):
ArchiveFactory does work with 7Zip though