mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
[PR #1101] [CLOSED] Fix LoadStreamForReadingAsync and add proper async code paths for RAR/ARJ multi-volume archives #1532
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/1101
Author: @Copilot
Created: 1/3/2026
Status: ❌ Closed
Base:
adam/rar-async-only← Head:copilot/sub-pr-1096📝 Commits (3)
980bfc3Initial planae45f0bFix LoadStreamForReadingAsync to properly initialize async enumerator and support multi-volume RAR archivesa35ddabReplace GetAwaiter().GetResult() with proper async code paths for file part enumeration📊 Changes
6 files changed (+342 additions, -36 deletions)
View changed files
📝
src/SharpCompress/Compressors/Rar/MultiVolumeReadOnlyStream.cs(+76 -24)📝
src/SharpCompress/Readers/AbstractReader.cs(+55 -6)📝
src/SharpCompress/Readers/Arj/ArjReader.cs(+5 -0)📝
src/SharpCompress/Readers/Arj/MultiVolumeArjReader.cs(+96 -0)📝
src/SharpCompress/Readers/Rar/MultiVolumeRarReader.cs(+104 -5)📝
src/SharpCompress/Readers/Rar/RarReader.cs(+6 -1)📄 Description
LoadStreamForReadingAsynchad an incorrect null check that threw "Entries async enumerator is not initialized" on first call, preventing async RAR operations withAsyncOnlyStream.Core fix:
LoadStreamForReadinglogicAsyncEnumeratorWrapper<T>to bridge async enumerator to syncEntryproperty andNextEntryForCurrentStream()callsAsync enumeration support:
NextEntryForCurrentStreamAsync()for async-aware entry iterationMoveToNextEntryAsync()to use async enumeration pathMulti-volume archive handling:
NextEntryForCurrentStreamAsync()inMultiVolumeRarReaderandMultiVolumeArjReaderAsyncOnlyStreamcompatibility by keeping all I/O async when file spans multiple volumesAsync file part enumeration (replacing
GetAwaiter().GetResult()):CreateFilePartAsyncEnumerableForCurrentEntry()method returningIAsyncEnumerable<FilePart>MultiVolumeStreamAsyncEnumerableclasses for RAR and ARJ multi-volume archives that properly await async operationsMultiVolumeReadOnlyStreamthat acceptsIAsyncEnumerable<RarFilePart>GetEntryStreamAsync()to use async enumerator instead of sync enumeratorRead/ReadAsyncmethods inMultiVolumeReadOnlyStreamto properly await async enumeratorsGetAwaiter().GetResult()calls, ensuring true async execution throughout the async code pathThe refactoring follows proper async/await patterns with separate code paths:
IEnumerable<FilePart>→ syncIEnumerator→ syncMoveNext()→ syncLoadStreamForReading()IAsyncEnumerable<FilePart>→ asyncIAsyncEnumerator→ asyncMoveNextAsync()→ asyncLoadStreamForReadingAsync()✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.