.NET 10 BufferedStream WriteByte: Flush Full Buffers Explicitly
BufferedStream.WriteByte had a surprising side effect through .NET 9: the call at its internal capacity boundary also called Flush() on the wrapped stream. The .NET 10 BufferedStream WriteByte behavior removes that implicit flush. Bytes can still move to the underlying stream when the buffer needs room, but that capacity boundary no longer becomes an accidental flush boundary. That distinction…
In .NET 10, the behavior of BufferedStream.WriteByte has changed, removing the implicit flush that occurred at the internal capacity boundary. This change was introduced in .NET 10 LTS, not as a preview feature, and is stable behavior. The modification affects applications that rely on the previous behavior of Flush() being called at the capacity boundary, particularly when using custom streams, protocol adapters, compressors, or test doubles where Flush() has additional meaning.
The change ensures that bytes can still be moved to the underlying stream when the buffer needs more space, but the capacity boundary no longer results in an accidental flush. Microsoft documents this behavior change for .NET 10, emphasizing that WriteByte now differs from other BufferedStream.Write methods in its behavior.
Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.