Skip to content

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

Merged
adamhathcock merged 3 commits intoadam/buffer-size-consolidationfrom
copilot/sub-pr-1165
Jan 27, 2026
Merged

Add [Obsolete] attribute to ReaderOptions.DefaultBufferSize for backward compatibility#1166
adamhathcock merged 3 commits intoadam/buffer-size-consolidationfrom
copilot/sub-pr-1165

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

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.

Copilot AI and others added 2 commits January 27, 2026 11:53
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
@adamhathcock adamhathcock marked this pull request as ready for review January 27, 2026 11:57
Copilot AI changed the title [WIP] Update to address feedback on buffer size consolidation PR Add [Obsolete] attribute to ReaderOptions.DefaultBufferSize for backward compatibility Jan 27, 2026
@adamhathcock adamhathcock merged commit d11f6ae into adam/buffer-size-consolidation Jan 27, 2026
@adamhathcock adamhathcock deleted the copilot/sub-pr-1165 branch January 27, 2026 11:57
Copilot AI requested a review from adamhathcock January 27, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants