Open bravequickcleverfibreyarn opened 2 weeks ago
I'm unsure what you're implying here. Are you saying this "what's new in .NET" post is wrong? According to the linked blog post about what's new, Stream can return less than the buffer yet still contain more data.
Yes, you understood. I suggest that both linked post and news article are wrong. As far as I remember Stream.Read
always returned all data up to buffer size. How it would be even possible to read it if it randomly returned not-all bytes?
I also briefly checked with code. I saw nothing what should convey behavior mentioned.
Check also:
Simply, I take text from https://learn.microsoft.com/en-us/dotnet/api/system.io.stream.read?view=net-8.0#system-io-stream-read(system-span((system-byte))) as gauge.
I guess somebody can be consulted.
Type of issue
Other (describe below)
Description
From https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-7#net-libraries
In fact,
Read
can return less bytes than buffer size is. Meaning all stream bytes are read as long as buffer is capacitated for it.See https://learn.microsoft.com/en-us/dotnet/api/system.io.stream.read?view=net-8.0#system-io-stream-read(system-span((system-byte))).
Page URL
https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-7
Content source URL
https://github.com/dotnet/docs/blob/main/docs/core/whats-new/dotnet-7.md
Document Version Independent Id
0d5a2ef0-b8a5-181f-db39-5a0ad4c182ff
Article author
@gewarren
Metadata