✅ Unable to read beyond the end of the stream.
Hello,
i have error : Unable to read beyond the end of the stream. at line "short hiheader = reader.ReadInt16();" do you know for what ?
thanks
4 Replies
do you know for whatfor attempting to read beyond the end of the stream, perhaps?
maybe the stream ended?
my guess is that when you are trying to read from the memory stream, you are actually past the data you want to read out. Have a look at the
https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream?view=net-7.0
Position
property of your memory stream. my guess is that if the position is at 0, then it will work fine.https://learn.microsoft.com/en-us/dotnet/api/system.io.memorystream?view=net-7.0
MemoryStream Class (System.IO)
Creates a stream whose backing store is memory.
oh yeah, you probably have to seek to beginning