[PR #1166] [MERGED] Add [Obsolete] attribute to ReaderOptions.DefaultBufferSize for backward compatibility #1603

Open
opened 2026-01-29 22:21:21 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/1166
Author: @Copilot
Created: 1/27/2026
Status: Merged
Merged: 1/27/2026
Merged by: @adamhathcock

Base: adam/buffer-size-consolidationHead: copilot/sub-pr-1165


📝 Commits (3)

  • 014bbc3 Initial plan
  • 53f12d7 Add [Obsolete] attribute to ReaderOptions.DefaultBufferSize
  • 010a38b Add clarifying comment about buffer size value difference

📊 Changes

1 file changed (+10 additions, -0 deletions)

View changed files

📝 src/SharpCompress/Readers/ReaderOptions.cs (+10 -0)

📄 Description

PR #1165 removed the public constant ReaderOptions.DefaultBufferSize, causing compilation errors for consumers referencing it. This PR restores the constant with deprecation guidance.

Changes

  • Restored ReaderOptions.DefaultBufferSize with original value (0x10000 = 65536 bytes) and [Obsolete] attribute directing users to Constants.BufferSize
  • Preserved new default behavior where BufferSize property defaults to Constants.BufferSize (81920 bytes, matching .NET's Stream.CopyTo)
  • Added documentation explaining the value difference and backward compatibility preservation

Migration Path

Existing code compiles with warning instead of error:

// Old code - now produces CS0618 warning but still compiles
var bufferSize = ReaderOptions.DefaultBufferSize; // 65536

// New code - use this going forward
var bufferSize = Constants.BufferSize; // 81920

New ReaderOptions instances automatically use the improved 81920-byte default while existing constant references remain functional.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/1166 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 1/27/2026 **Status:** ✅ Merged **Merged:** 1/27/2026 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `adam/buffer-size-consolidation` ← **Head:** `copilot/sub-pr-1165` --- ### 📝 Commits (3) - [`014bbc3`](https://github.com/adamhathcock/sharpcompress/commit/014bbc3ea480e7cdcf07b0842c398ca42b49952e) Initial plan - [`53f12d7`](https://github.com/adamhathcock/sharpcompress/commit/53f12d75db91be1d1c38773cea93a516c18e916b) Add [Obsolete] attribute to ReaderOptions.DefaultBufferSize - [`010a38b`](https://github.com/adamhathcock/sharpcompress/commit/010a38bb7369ccb646479dd638262a2082522575) Add clarifying comment about buffer size value difference ### 📊 Changes **1 file changed** (+10 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Readers/ReaderOptions.cs` (+10 -0) </details> ### 📄 Description PR #1165 removed the public constant `ReaderOptions.DefaultBufferSize`, causing compilation errors for consumers referencing it. This PR restores the constant with deprecation guidance. ## Changes - **Restored `ReaderOptions.DefaultBufferSize`** with original value (0x10000 = 65536 bytes) and `[Obsolete]` attribute directing users to `Constants.BufferSize` - **Preserved new default behavior** where `BufferSize` property defaults to `Constants.BufferSize` (81920 bytes, matching .NET's Stream.CopyTo) - **Added documentation** explaining the value difference and backward compatibility preservation ## Migration Path Existing code compiles with warning instead of error: ```csharp // Old code - now produces CS0618 warning but still compiles var bufferSize = ReaderOptions.DefaultBufferSize; // 65536 // New code - use this going forward var bufferSize = Constants.BufferSize; // 81920 ``` New `ReaderOptions` instances automatically use the improved 81920-byte default while existing constant references remain functional. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:21:21 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1603