I\'ve done a bit of searching, and most people seem to hit this when sending larger amounts of data, but I\'m not.
I\'m making a request to an API with the followin
Having looked over the docs - System.IO.StreamWriter.Write() - There does not appear to be a method for writing bytes.
The only method that matches the signature is - StreamWriter.Write(Object)
. This however calls ToString()
on the object and writes the output; Which is not what you want.
As you are setting an output buffer; the stream is waiting for this buffer to be filled. However, the Object.ToString()
will likely not fill this buffer and hence the error.
Use BinaryWriter
, BufferedStream
or another that supports byte[]
writing.