IndexOutOfRangeException when a stream is a multiple of the buffer size
- by dnord
I don't have a lot of experience with streams and buffers, but I'm having to do it for a project, and I'm stuck on an exception being thrown when the stream I'm reading is a multiple of the buffer size I've chosen. Let me show you:
My code starts by reading bufferSize (100, let's say) bytes from the stream:
numberOfBytesRead =…