Open
Description
Hi,
The doc for StreamReader.Read(Span<Char>)
claims that it'll throw an IOException if "the number of characters read from the stream is larger than the buffer length."
This is not true, as seen with this code:
var array = new char[8];
Span<char> span = array;
File.WriteAllText("text.txt", "0123456789");
using StreamReader reader = new("text.txt");
var result = reader.Read(span);
Console.WriteLine(result);
Console.WriteLine(span.ToString());
// 8
// 01234567
StringReader has the same behavior and is documented correctly:
// StringReader
var array = new char[8];
var span = array;
using StringReader textReader = new("0123456789");
var result = textReader.Read(span);
Console.WriteLine(result);
Console.WriteLine(span.ToString());
// 8
// 01234567
If it's welcome, I would be happy to help fix the documentation