Make ZipArchiveEntry.CompressionMethod public#122045
Merged
iremyux merged 7 commits intodotnet:mainfrom Dec 4, 2025
Merged
Conversation
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCompressionMethod.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/ref/System.IO.Compression.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs
Show resolved
Hide resolved
This was referenced Dec 4, 2025
Open
rokonec
approved these changes
Dec 4, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes the compression method of ZIP archive entries as a public API by introducing a new ZipCompressionMethod enum and a public CompressionMethod property on ZipArchiveEntry. The change replaces the internal CompressionMethodValues enum throughout the codebase and simplifies error handling for unsupported compression methods.
- Adds public
ZipCompressionMethodenum with values for Stored (0), Deflate (8), and Deflate64 (9) - Exposes
CompressionMethodproperty onZipArchiveEntryas a public getter - Consolidates error messages for unsupported compression methods to use a single generic message
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipCompressionMethod.cs |
New public enum defining supported ZIP compression methods (Stored, Deflate, Deflate64) with values matching ZIP specification |
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.cs |
Replaces internal CompressionMethodValues with public ZipCompressionMethod; makes CompressionMethod property public; removes old internal enum; simplifies error handling |
src/libraries/System.IO.Compression/src/System/IO/Compression/ZipArchiveEntry.Async.cs |
Updates async methods to use ZipCompressionMethod instead of CompressionMethodValues |
src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateManaged/DeflateManagedStream.cs |
Updates constructor parameter and assertions to use ZipCompressionMethod |
src/libraries/System.IO.Compression/src/System.IO.Compression.csproj |
Adds new ZipCompressionMethod.cs file to compilation |
src/libraries/System.IO.Compression/ref/System.IO.Compression.cs |
Adds public API surface for ZipCompressionMethod enum and CompressionMethod property |
src/libraries/System.IO.Compression/tests/ZipArchive/zip_ReadTests.cs |
Updates existing test to use ZipCompressionMethod; adds three new tests for Deflate, Stored, and empty file compression methods |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 PR exposes the compression method of ZIP archive entries through a new public
ZipCompressionMethodenum and a publicCompressionMethodproperty onZipArchiveEntry.SR.UnsupportedCompressioninstead of method-specific messages for BZip2/LZMA.Fixes #95909