System.NotSupportedException: 'Specified method is not supported.' On reader.MoveToNextEntry() while decompresing 7z #564

Closed
opened 2026-01-29 22:13:49 +00:00 by claunia · 11 comments
Owner

Originally created by @GamingCity on GitHub (Mar 11, 2023).

Ive been getting this exception when i try to extract a 7zip file, it always start extracting files and get to the same point and throws the exception.

using (var archive = ArchiveFactory.Open("D:\test.7z"))
{
var reader = archive.ExtractAllEntries();
reader.EntryExtractionProgress += Reader_EntryExtractionProgress;
while (reader.MoveToNextEntry()) <--Exception here
{
if (!reader.Entry.IsDirectory)
reader.WriteEntryToDirectory("D:\temp", new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
}
}
void Reader_EntryExtractionProgress(object? sender, ReaderExtractionEventArgs e)
{
Console.WriteLine($"{e.Item.Key}: {e.ReaderProgress.PercentageRead} % read, {e.ReaderProgress.PercentageReadExact} % extracted");
}

Im using .net 6.0 on a simple console app.
image

It seems to complain that it cant call reflection from this context, yet i dont understand why it manages to extract half the file before having this problem.

WriteAllToDirectory() also gives this exception.

Originally created by @GamingCity on GitHub (Mar 11, 2023). Ive been getting this exception when i try to extract a 7zip file, it always start extracting files and get to the same point and throws the exception. using (var archive = ArchiveFactory.Open("D:\\test.7z")) { var reader = archive.ExtractAllEntries(); reader.EntryExtractionProgress += Reader_EntryExtractionProgress; while (reader.MoveToNextEntry()) <--Exception here { if (!reader.Entry.IsDirectory) reader.WriteEntryToDirectory("D:\\temp", new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } void Reader_EntryExtractionProgress(object? sender, ReaderExtractionEventArgs<IEntry> e) { Console.WriteLine($"{e.Item.Key}: {e.ReaderProgress.PercentageRead} % read, {e.ReaderProgress.PercentageReadExact} % extracted"); } Im using .net 6.0 on a simple console app. ![image](https://user-images.githubusercontent.com/59067016/224494470-c937843e-d451-426d-8cdb-8059898a0d72.png) It seems to complain that it cant call reflection from this context, yet i dont understand why it manages to extract half the file before having this problem. WriteAllToDirectory() also gives this exception.
Author
Owner

@Erior commented on GitHub (Mar 11, 2023):

Can be DeltaFilter #726, do you have the test file somewhere or can you build from this repo and test/report the CMethodId id value when it fails?

@Erior commented on GitHub (Mar 11, 2023): Can be DeltaFilter #726, do you have the test file somewhere or can you build from this repo and test/report the CMethodId id value when it fails?
Author
Owner

@Shivansps commented on GitHub (Mar 11, 2023):

(sorry i posted the issue from the wrong account)
Yeah this is the file, its extensionless but it is a 7z. 9cb349c96e

@Shivansps commented on GitHub (Mar 11, 2023): (sorry i posted the issue from the wrong account) Yeah this is the file, its extensionless but it is a 7z. https://cf.fsnebula.org/storage/38/aa/9cb349c96e4fc0d9e3b88d681642764af71cdf9476a7af6281caafdffafd
Author
Owner

@Erior commented on GitHub (Mar 12, 2023):

If you open it in 7z you can see that some entries are using Method Delta:X LZMA, The support for this was added recently and has not yet been released.

@Erior commented on GitHub (Mar 12, 2023): If you open it in 7z you can see that some entries are using Method Delta:X LZMA, The support for this was added recently and has not yet been released.
Author
Owner

@GamingCity commented on GitHub (Mar 13, 2023):

ok if this is fixed on main then ill close this for now.

@GamingCity commented on GitHub (Mar 13, 2023): ok if this is fixed on main then ill close this for now.
Author
Owner

@GamingCity commented on GitHub (Mar 17, 2023):

OK, using master instead of the nuget package allowed to decompress a lot more files, but im still finding some of them fail to decompress...
Like this one:
0af317e290

It seems that there is a Delta:1 and a Delta:2 but i dont think thats the issue as it seems to extract those files or most of those files just fine.

OK this is thwing the exception at deltafilter.cs, _distance is 0

public DeltaFilter(bool isEncoder, Stream baseStream, byte[] info) : base(isEncoder, baseStream, 1)
{
_distance = info[0];
_history = new byte[DISTANCE_MAX];
_position = 0;

  if (_distance < DISTANCE_MIN)
  {
      throw new NotSupportedException();
  }

}

@GamingCity commented on GitHub (Mar 17, 2023): OK, using master instead of the nuget package allowed to decompress a lot more files, but im still finding some of them fail to decompress... Like this one: https://cf.fsnebula.org/storage/7c/ba/0af317e290e891db84e4674bff95ded7ac5a10785292b59bca26381878d1 It seems that there is a Delta:1 and a Delta:2 but i dont think thats the issue as it seems to extract those files or most of those files just fine. OK this is thwing the exception at deltafilter.cs, _distance is 0 public DeltaFilter(bool isEncoder, Stream baseStream, byte[] info) : base(isEncoder, baseStream, 1) { _distance = info[0]; _history = new byte[DISTANCE_MAX]; _position = 0; if (_distance < DISTANCE_MIN) { throw new NotSupportedException(); } }
Author
Owner

@Erior commented on GitHub (Mar 19, 2023):

Using the link, it actually fails on a file that 7zip says does not use the delta method, I will see if there are other conditions than the ID for the filter detection

@Erior commented on GitHub (Mar 19, 2023): Using the link, it actually fails on a file that 7zip says does not use the delta method, I will see if there are other conditions than the ID for the filter detection
Author
Owner

@Erior commented on GitHub (Mar 19, 2023):

and I was wrong, but it looks to be a noop setup, not applying the filter seems to be the right way, I'll look into it some more later

@Erior commented on GitHub (Mar 19, 2023): and I was wrong, but it looks to be a noop setup, not applying the filter seems to be the right way, I'll look into it some more later
Author
Owner

@Erior commented on GitHub (Mar 19, 2023):

From my testing it looks like the check should be removed #735

@Erior commented on GitHub (Mar 19, 2023): From my testing it looks like the check should be removed #735
Author
Owner

@Erior commented on GitHub (Mar 21, 2023):

@GamingCity please try master again, the changes has been merged.

@Erior commented on GitHub (Mar 21, 2023): @GamingCity please try master again, the changes has been merged.
Author
Owner

@GamingCity commented on GitHub (Mar 22, 2023):

Seems to be working fine now, thanks.

@GamingCity commented on GitHub (Mar 22, 2023): Seems to be working fine now, thanks.
Author
Owner

@adamhathcock commented on GitHub (Mar 22, 2023):

Thanks both!

@adamhathcock commented on GitHub (Mar 22, 2023): Thanks both!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#564