End of Stream encountered before parsing was completed?

Make sure the serialization completed, and that the serialization type matches the de-serialization type (i.e., make sure you're serializing with a BinaryFormatter if you're de-serializing with one). Also, make sure that the stream you serialized to really finished serializing, with a Stream.Flush() or something to that effect.


I had the same exception thrown, until I added the [Serializable] tag to the class I was Serializing :)

Then it all worked perfectly.


Try to set the position to 0 of your stream and do not use your object but the object type.

        BinaryFormatter b = new BinaryFormatter();
        s.Position = 0;
        return (YourObjectType)b.Deserialize(s);