Skip to content

Rename compression WindowLog APIs to WindowLog2 - #129977

Merged
rzikm merged 9 commits into
mainfrom
copilot/rename-windowlog-to-windowlog2
Jul 8, 2026
Merged

rzikm merged 9 commits into
mainfrom
copilot/rename-windowlog-to-windowlog2

Conversation

Copilot AI commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Based on a feedback from #128456 (comment)

Renames compression option APIs that exposed WindowLog so the public surface consistently uses WindowLog2 for base-2 log values, including the matching Zstandard decompression property MaxWindowLog2.

  • API surface

    • BrotliCompressionOptions.WindowLog → WindowLog2
    • ZLibCompressionOptions.WindowLog → WindowLog2
    • ZstandardCompressionOptions.WindowLog → WindowLog2
    • ZstandardDecompressionOptions.MaxWindowLog → MaxWindowLog2
    • Aligns related public members to the same naming:
      • zlib/zstd DefaultWindowLog*, MinWindowLog*, MaxWindowLog* → *WindowLog2
      • encoder / decoder parameter names windowLog / maxWindowLog → windowLog2 / maxWindowLog2
  • Implementation updates

    • Updates all in-repo call sites, option consumers, constructors, ref files, platform stubs, XML docs, and error text.
    • Ensures thrown ArgumentOutOfRangeException.ParamName values match the renamed public parameters.
  • Compatibility

    • This is an intentional public API rename; no compatibility alias/shim is added.
  • Example

    var options = new ZstandardCompressionOptions
    {
        Quality = 3,
        WindowLog2 = 20
    };
    
    var decompressionOptions = new ZstandardDecompressionOptions
    {
        MaxWindowLog2 = 20
    };
  • Validation

    • Rebuilt System.IO.Compression and System.IO.Compression.Brotli
    • Ran targeted test projects:
      • System.IO.Compression.Tests
      • System.IO.Compression.Brotli.Tests

Copilot AI requested review from Copilot and removed request for Copilot June 29, 2026 13:58
Copilot AI requested review from Copilot and removed request for Copilot June 29, 2026 14:07
Copilot AI requested review from Copilot and removed request for Copilot June 29, 2026 14:09
Copilot AI changed the title [WIP] Rename WindowLog properties to WindowLog2 in compression options Rename compression WindowLog APIs to WindowLog2 Jun 29, 2026
Copilot AI requested a review from rzikm June 29, 2026 14:10
Copilot finished work on behalf of rzikm June 29, 2026 14:10

@rzikm rzikm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Don't add string paramName parameters, but rename the existing parameters.

Copilot AI requested review from Copilot and removed request for Copilot June 29, 2026 15:19

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Don't add string paramName parameters, but rename the existing parameters.

Addressed in e2c1640.

Copilot AI requested a review from rzikm June 29, 2026 15:23
Copilot finished work on behalf of rzikm June 29, 2026 15:23
Copilot AI requested review from Copilot and removed request for Copilot June 29, 2026 15:58

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot you missed two places

Fixed in a9dd414.

Copilot finished work on behalf of rzikm June 29, 2026 16:06
Copilot AI requested a review from rzikm June 29, 2026 16:06
@rzikm
rzikm marked this pull request as ready for review June 29, 2026 16:14
Copilot AI review requested due to automatic review settings June 29, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Renames the WindowLog / MaxWindowLog public-facing compression option members and related parameter names to *WindowLog2 / *MaxWindowLog2 to make the base-2 logarithm semantics explicit and consistent across Brotli, zlib/deflate/gzip, and Zstandard APIs.

Changes:

  • Renames public option properties and related helpers/constants to *WindowLog2 (and Zstd decompression MaxWindowLog2), including ref assembly updates.
  • Updates encoder/decoder constructors, parameter validation (ArgumentOutOfRangeException.ParamName), and call sites to use the new parameter names.
  • Updates tests and user-facing error text to match the new naming.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/libraries/System.IO.Compression/tests/Zstandard/ZstandardEncoderDecoderTests.cs Updates Zstd encoder/decoder tests for renamed ctor parameters and messages.
src/libraries/System.IO.Compression/tests/Zstandard/ZstandardCompressionOptionsTests.cs Updates Zstd options tests to WindowLog2 / MaxWindowLog2.
src/libraries/System.IO.Compression/tests/ZLibEncoderDecoderTestBase.cs Aligns shared zlib test base to expect windowLog2 param name.
src/libraries/System.IO.Compression/tests/ZLibCompressionOptionsUnitTests.cs Renames zlib options tests for WindowLog2 and *WindowLog2 statics.
src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardEncoder.cs Renames Zstd encoder ctors/overloads and validation to windowLog2.
src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecompressionOptions.cs Renames and validates decompression option MaxWindowLog2.
src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardDecoder.cs Renames Zstd decoder ctors/validation to maxWindowLog2.
src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/ZstandardCompressionOptions.cs Renames Zstd compression option WindowLog2 and related statics/docs.
src/libraries/System.IO.Compression/src/System/IO/Compression/Zstandard/Zstandard.PlatformNotSupported.cs Updates platform stub members/ctors to *WindowLog2 naming.
src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibStream.cs Uses ZLibCompressionOptions.WindowLog2 when resolving window bits.
src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibEncoder.cs Renames zlib encoder ctor/overload parameter to windowLog2.
src/libraries/System.IO.Compression/src/System/IO/Compression/ZLibCompressionOptions.cs Renames zlib options property/fields/statics to *WindowLog2.
src/libraries/System.IO.Compression/src/System/IO/Compression/GZipStream.cs Uses ZLibCompressionOptions.WindowLog2 when resolving window bits.
src/libraries/System.IO.Compression/src/System/IO/Compression/GZipEncoder.cs Renames gzip encoder ctor/overload parameter to windowLog2.
src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateZLib/DeflateStream.cs Uses ZLibCompressionOptions.WindowLog2 when resolving window bits.
src/libraries/System.IO.Compression/src/System/IO/Compression/DeflateEncoder.cs Renames deflate encoder ctors/overloads and validation to windowLog2.
src/libraries/System.IO.Compression/src/Resources/Strings.resx Updates the Zstd “window too large” guidance text to maxWindowLog2.
src/libraries/System.IO.Compression/ref/System.IO.Compression.cs Updates public ref surface for renamed members/parameters (*WindowLog2).
src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs Updates Brotli options tests to WindowLog2.
src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliStream.Compress.cs Uses BrotliCompressionOptions.WindowLog2 when configuring encoder.
src/libraries/System.IO.Compression.Brotli/src/System/IO/Compression/enc/BrotliCompressionOptions.cs Renames Brotli options property/field to WindowLog2.
src/libraries/System.IO.Compression.Brotli/ref/System.IO.Compression.Brotli.cs Updates Brotli ref surface to expose WindowLog2.
src/libraries/Common/tests/System/IO/Compression/EncoderDecoderTestBase.cs Aligns shared encoder/decoder test expectations to windowLog2 naming.
src/libraries/Common/tests/System/IO/Compression/CompressionStreamUnitTestBase.cs Updates shared stream roundtrip test name and option property to WindowLog2.

@iremyux iremyux left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand how WindowLog can be confusing, at the same time I am not a big fan of WindowLog2. But I guess WindowLog2 is better.

Copilot AI requested review from Copilot and removed request for Copilot July 7, 2026 17:41
Copilot finished work on behalf of rzikm July 7, 2026 17:41
…owLog2 in DecompressionHandler and test

Co-authored-by: rzikm <[email protected]>
Copilot AI requested review from Copilot and removed request for Copilot July 7, 2026 18:49
Copilot finished work on behalf of rzikm July 7, 2026 18:49
@rzikm
rzikm merged commit f9a6e2e into main Jul 8, 2026
88 checks passed
@rzikm
rzikm deleted the copilot/rename-windowlog-to-windowlog2 branch July 8, 2026 08:49
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 10, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
Based on a feedback from
#128456 (comment)

<!-- -->

Renames compression option APIs that exposed `WindowLog` so the public
surface consistently uses `WindowLog2` for base-2 log values, including
the matching Zstandard decompression property `MaxWindowLog2`.

- **API surface**
  - `BrotliCompressionOptions.WindowLog` → `WindowLog2`
  - `ZLibCompressionOptions.WindowLog` → `WindowLog2`
  - `ZstandardCompressionOptions.WindowLog` → `WindowLog2`
  - `ZstandardDecompressionOptions.MaxWindowLog` → `MaxWindowLog2`
  - Aligns related public members to the same naming:
- zlib/zstd `DefaultWindowLog*`, `MinWindowLog*`, `MaxWindowLog*` →
`*WindowLog2`
- encoder / decoder parameter names `windowLog` / `maxWindowLog` →
`windowLog2` / `maxWindowLog2`

- **Implementation updates**
- Updates all in-repo call sites, option consumers, constructors, ref
files, platform stubs, XML docs, and error text.
- Ensures thrown `ArgumentOutOfRangeException.ParamName` values match
the renamed public parameters.

- **Compatibility**
- This is an intentional public API rename; no compatibility alias/shim
is added.

- **Example**
  ```csharp
  var options = new ZstandardCompressionOptions
  {
      Quality = 3,
      WindowLog2 = 20
  };

  var decompressionOptions = new ZstandardDecompressionOptions
  {
      MaxWindowLog2 = 20
  };
  ```

- **Validation**
  - Rebuilt `System.IO.Compression` and `System.IO.Compression.Brotli`
  - Ran targeted test projects:
    - `System.IO.Compression.Tests`
    - `System.IO.Compression.Brotli.Tests`

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: rzikm <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants