Fix synchronous reads called in async RAR unpacker paths#1305
Closed
Copilot wants to merge 2 commits into
Closed
Conversation
…npack5Async) Agent-Logs-Url: https://github.com/adamhathcock/sharpcompress/sessions/7f2fcb59-4a41-4b27-ab32-17afec510b5e Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix sync methods used in Async APIs
Fix synchronous reads called in async RAR unpacker paths
Apr 28, 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.
Async RAR extraction fails with
NotSupportedExceptionwhen the underlying stream is async-only (e.g.,MultiVolumeReadOnlyAsyncStream), becauseUnpack29AsyncandUnpack5Asyncwere calling sync methods that internally invokereadStream.Read(...).Changes
Unpack.Async.cs— Added async counterparts for three sync methods used inUnpack29Async:ReadTablesAsync()— mirrorsReadTables(), replacingunpReadBuf()calls withawait unpReadBufAsync(). Uses heap-allocated arrays instead ofstackalloc(not permitted in async methods).ReadEndOfBlockAsync()— mirrorsReadEndOfBlock(), delegates toReadTablesAsync().ReadVMCodeAsync()— mirrorsReadVMCode(), replacingunpReadBuf()withawait unpReadBufAsync().Unpack29Asyncto call all three async variants.Unpack50.Async.cs— UpdatedUnpack5Asyncto callawait ReadTablesAsync()instead ofReadTables()at both call sites.Example (the failing path)