Add more Async tests and complete Zip tests#991
Merged
adamhathcock merged 12 commits intomasterfrom Oct 28, 2025
Merged
Conversation
# Conflicts: # src/SharpCompress/packages.lock.json
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request adds comprehensive asynchronous support to the SharpCompress library, enabling non-blocking operations for reading and processing compressed archives. The changes include async variants of key reader and stream operations, expanded test coverage with new async test classes, and minor code cleanup improvements.
- Added async methods (
MoveToNextEntryAsync,OpenEntryStreamAsync,ReadAsync) to core reader and stream classes - Created four new async test suites for Zip archives (reader, writer, archive operations, and memory tests with CRC validation)
- Updated existing test infrastructure to support async operations and added missing
[Fact]attributes to sync tests
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/SharpCompress.Test/Zip/ZipWriterAsyncTests.cs | New async test suite covering Zip writer operations with various compression types |
| tests/SharpCompress.Test/Zip/ZipReaderAsyncTests.cs | New async test suite for Zip reader functionality including encryption and streaming scenarios |
| tests/SharpCompress.Test/Zip/ZipMemoryArchiveWithCrcAsyncTests.cs | New async tests for compression levels, CRC validation, and memory-based archive operations |
| tests/SharpCompress.Test/Zip/ZipArchiveAsyncTests.cs | New async test suite for archive stream reading and modification operations |
| tests/SharpCompress.Test/Zip/Zip64Tests.cs | Added missing [Fact] attributes to enable previously disabled tests |
| tests/SharpCompress.Test/Zip/Zip64AsyncTests.cs | New async test suite for Zip64 large file handling |
| tests/SharpCompress.Test/ReaderTests.cs | Updated to use async reader API in UseReaderAsync method |
| tests/SharpCompress.Test/Mocks/ForwardOnlyStream.cs | Enhanced with async read/write/flush support and enabled write capability |
| src/SharpCompress/packages.lock.json | Downgraded Microsoft.NET.ILLink.Tasks from 8.0.20 to 8.0.17 |
| src/SharpCompress/Readers/IReader.cs | Added async method declarations to reader interface |
| src/SharpCompress/Readers/AbstractReader.cs | Implemented async methods for entry navigation and stream operations |
| src/SharpCompress/IO/ReadOnlySubStream.cs | Added async read methods with Memory support |
| src/SharpCompress/Compressors/Deflate64/Deflate64Stream.cs | Added async read support and removed unused fields/methods |
| src/SharpCompress/Common/Zip/StreamingZipHeaderFactory.cs | Minor refactoring to use var declarations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closed
This was referenced Nov 28, 2025
This was referenced Dec 8, 2025
This was referenced Dec 15, 2025
This was referenced Dec 22, 2025
This was referenced Jan 5, 2026
This was referenced Jan 12, 2026
This was referenced Jan 19, 2026
This was referenced Jan 26, 2026
This was referenced Feb 13, 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.
This pull request introduces asynchronous support to the SharpCompress library, enabling non-blocking operations for reading and skipping entries in compressed archives. The changes add async methods to core stream and reader classes, improve compatibility with modern .NET features, and update tests and mocks to support async operations. Additionally, some code cleanup and minor refactoring are included.
Async API additions and enhancements:
ReadAsyncandValueTask<int> ReadAsyncmethods toDeflate64StreamandReadOnlySubStreamto support asynchronous decompression and reading, including handling forMemory<byte>buffers on modern .NET platforms. [1] [2]MoveToNextEntryAsyncandOpenEntryStreamAsyncin bothIReaderinterface andAbstractReaderclass, allowing entries to be processed asynchronously. [1] [2] [3]SkipEntryAsyncandSkipAsyncinAbstractReader, enabling efficient skipping of entries without blocking. [1] [2]Test and mock updates for async support:
ForwardOnlyStreammock to implement async read/write/flush methods, and adjustedCanWriteto support writing, improving test coverage for async scenarios. [1] [2]ReaderTeststo use the new async reader API, ensuring tests validate asynchronous behavior.Codebase cleanup and minor refactoring:
Deflate64Stream, simplified property implementations, and updated disposal logic for better resource management. [1] [2] [3] [4] [5]StreamingZipHeaderFactoryfor improved code clarity. [1] [2]Dependency update:
Microsoft.NET.ILLink.Taskspackage version inpackages.lock.jsonfor compatibility.