Skip to content

[Breaking change]: Validate CompressionLevel for BrotliStream #25665

Closed

Description

@i3arnon

Description

The change validates that the CompressionLevel argument of the System.IO.Compression.BrotliStream constructors is a defined value of the enum: Optimal, Fastest, NoCompression or SmallestSize.

Previously any underlying value from 0 to 11 would be valid and passed on as the level to Brotli, unless it's mapped to any of the CompressionLevel enum values.

Version

.NET 7 Preview 1

Previous behavior

Passing any value between 0 and 11 to the CompressionLevel parameter BrotliStream would be valid.
The value would either map to the one of the enum's defined values or passed as is to the underlying Brotli implementation.

New behavior

Only Optimal, Fastest, NoCompression or SmallestSize are valid values for the CompressionLevel parameter.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

Being able to pass arbitrary values which are not defined by the CompressionLevel enum is unexpected and undocumented with a probability for mistakes.

Recommended action

Pass in only one of the valid values for CompressionLevel

Feature area

Core .NET libraries

Affected APIs

All System.IO.Compression.BrotliStream constructors that accept CompressionLevel

Activity

  1. added
    breaking-change
    on Aug 17, 2021
  2. added
    ⌚ Not Triaged
    binary incompatible
    source incompatible
    on Aug 17, 2021
  3. i3arnon commented on Aug 17, 2021

    @i3arnon
    Author

    The relevant PR: dotnet/runtime#57561

  4. added
    🚧 Hold for related PR
    and removed
    ⌚ Not Triaged
    on Aug 17, 2021
  5. changed the title [-][Breaking change]: [/-] [+][Breaking change]: Validate CompressionLevel for BrotliStream[/+] on Aug 17, 2021
  6. carlossanlop commented on Nov 1, 2021

    @carlossanlop
    Contributor

    Thank you @i3arnon for adding the breaking change doc!

    The linked PR dotnet/runtime#57561 will hopefully be merged this week got merged. I edited the "Version" section of the description to indicate it would go to Preview 1. @gewarren please let me know if the value should be different.

  7. added
    🏁 Release: .NET 7
    on Nov 1, 2021
  8. removed
    🚧 Hold for related PR
    on Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 7binary incompatiblebreaking-changesource incompatible

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions