-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document breaking change: DeflateStream and GZipStream now encode empty payloads #51002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…yload encoding - Created breaking change article for .NET 11 Preview 1 - Updated 11.md index with new entry - Updated toc.yml with new article link - Added note to how-to-compress-and-extract-files.md referencing the breaking change The article documents the behavioral change where DeflateStream and GZipStream now always write headers and footers even for empty payloads, ensuring properly formatted compressed streams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR documents a breaking change in .NET 11 Preview 1 where DeflateStream and GZipStream now always write compression headers and footers, even when no data is written. Previously, these streams produced no output for empty payloads.
- Creates comprehensive breaking change documentation with examples and migration guidance
- Updates navigation structure to include the new breaking change entry
- Includes whitespace cleanup in related documentation file
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
docs/core/compatibility/core-libraries/11/deflatestream-gzipstream-empty-payload.md |
New breaking change documentation describing the behavior change, including code examples and recommended actions |
docs/core/compatibility/toc.yml |
Adds TOC entry for the new breaking change article |
docs/core/compatibility/11.md |
Adds table entry linking to the new breaking change documentation |
docs/standard/io/how-to-compress-and-extract-files.md |
Whitespace cleanup (removes trailing spaces from YAML headers and links) |
| { | ||
| // No data written. | ||
| } | ||
| Console.WriteLine(output.Length); // 2 (for Deflate) or 10 (for GZip). |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment at line 39 contains inconsistent information. According to the PR description example, GZipStream should produce 20 bytes for an empty payload, not 10 bytes. The comment should be corrected to match the actual behavior.
| Console.WriteLine(output.Length); // 2 (for Deflate) or 10 (for GZip). | |
| Console.WriteLine(output.Length); // 2 (for Deflate) or 20 (for GZip). |
|
|
||
| ## Recommended action | ||
|
|
||
| If the previous behavior is desired, special case empty content to not compress it via `DeflateStream` or `GZipStream`. |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phrase "special case" should be hyphenated when used as a verb. Change "special case empty content" to "special-case empty content".
In .NET 11 Preview 1,
DeflateStreamandGZipStreamchanged to always write compression headers and footers, even when no data is written. Previously, empty payloads produced no output.Changes
docs/core/compatibility/core-libraries/11/deflatestream-gzipstream-empty-payload.mdhow-to-compress-and-extract-files.mdExample
Workaround for previous behavior: special-case empty content to skip compression.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Internal previews