Fix SevenZipArchive.IsSolidAsync() always returning false#1284
Merged
Conversation
SevenZipArchive was missing an override for IsSolidAsync(), so the base class default (always returning false) was used. Added an override that uses the same logic as the sync IsSolid property: load entries asynchronously and check if any folder has more than one file. Also updated existing async tests to use IsSolidAsync() instead of casting to SevenZipArchive to call the sync IsSolid, and added a new SevenZipArchive_TestSolidDetectionAsync test that mirrors the existing sync SevenZipArchive_TestSolidDetection test. Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/60f8daec-e784-4845-a65c-5a493fbb53ef Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix inconsistent solid check between sync and async methods for 7z archive
Fix SevenZipArchive.IsSolidAsync() always returning false
Apr 13, 2026
adamhathcock
approved these changes
Apr 13, 2026
This was referenced May 6, 2026
Closed
This was referenced May 11, 2026
This was referenced May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IAsyncArchive.IsSolidAsync()always returnedfalsefor 7z archives regardless of archive structure, whileIArchive.IsSolidreturned the correct value.Root cause
AbstractArchive.Async.csprovides a base implementation that always returnsfalse:SevenZipArchiveoverrides the syncIsSolidproperty correctly (checking if any compressed folder contains more than one file), but was missing the async counterpart.RarArchivealready has its ownIsSolidAsync()override.Changes
SevenZipArchive.Async.cs: AddedIsSolidAsync()override using async enumeration with the same logic as the sync property. UsesSkip(1).Any()rather thanCount() > 1to short-circuit on the second element:SevenZipArchive.cs: Applied the sameSkip(1).Any()optimization to the syncIsSolidproperty.SevenZipArchiveAsyncTests.cs: AddedSevenZipArchive_TestSolidDetectionAsyncto verify async detection matches sync detection across solid, single-block solid, and non-solid archives. Updated existing async tests to useIsSolidAsync()directly instead of casting to the concrete type to access the sync property.