Question
what is Exception "End of Stream encountered before parsing was completed." in the my code?
BinaryFormatter t = new BinaryFormatter();
MemoryStream n = new MemoryStream();
t.Serialize(n, j);
BinaryFormatter q = new BinaryFormatter();
MemoryStream x = new MemoryStream();
q.Deserialize(n);
Solution
After serializing the object to the stream, the stream's Position
is at the end.
Therefore, there is nothing more in the stream for the deserializer to read.
You need to rewind the stream, by setting n.Position = 0
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow