mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-09 05:24:55 +00:00
[PR #1172] [MERGED] Fix SevenZipReader to maintain contiguous stream state for solid archives #1612
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?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/1172
Author: @Copilot
Created: 1/27/2026
Status: ✅ Merged
Merged: 1/28/2026
Merged by: @adamhathcock
Base:
release← Head:copilot/fix-sevenzip-contiguous-streams📝 Commits (6)
72eaf66Initial plandb2f5c9Fix SevenZipReader to iterate entries as contiguous streams999124eRemove unused _currentFolderIndex field3c87242Add test to verify folder stream reuse in solid archives8a67d50Don't use reflection in tests484bc74Update src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs📊 Changes
3 files changed (+174 additions, -12 deletions)
View changed files
📝
src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs(+68 -12)📝
tests/SharpCompress.Test/SevenZip/SevenZipArchiveTests.cs(+94 -0)📝
tests/SharpCompress.Test/packages.lock.json(+12 -0)📄 Description
SevenZipReader was recreating the decompression stream for each entry in solid archives (where multiple files share a compressed stream), breaking the sequential read requirement and causing data corruption and performance issues.
Changes
_currentFolderStreamand_currentFolderfields toSevenZipReaderReadOnlySubStreambounded by entry sizeImplementation
Testing
SevenZipArchive_Solid_ExtractAllEntries_Contiguousverifies that solid archives can be extracted successfully using the readerSevenZipArchive_Solid_VerifyStreamReuseuses reflection to access private fields and verify that:streamRecreationsWithinFolder == 0)This definitively proves the contiguous streaming behavior has been restored and that the stream is properly reused, not recreated per entry.
This restores the contiguous streaming behavior that existed before 0.41.0.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.