diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs b/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs index 40abcbdac5580a..09aa09d3446056 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/BufferedStream.cs @@ -1166,9 +1166,12 @@ private void WriteByteSlow(byte value) EnsureBufferAllocated(); } - // We should not be flushing here, but only writing to the underlying stream, but previous version flushed, so we keep this. if (_writePos >= _bufferSize - 1) - FlushWrite(); + { + Debug.Assert(_stream != null); + _stream.Write(_buffer!, 0, _writePos); + _writePos = 0; + } _buffer![_writePos++] = value;