المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization.



C# Programming
02-20-2013, 07:02 AM
Hello everyone. I get this excepction "Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization.". I am looking for solution about this exception 2 day's now with out success.I tried (i think) everthing http://www.barakasoft.com/script/Forums/Images/smiley_doh.gif .
Please can someone take a look on code bellow? where is error?

Thank's.

private player ByteArrayToPlayer(byte[] temp) { try { MemoryStream objectStream = new MemoryStream(temp); IFormatter BinaryFormatter = new BinaryFormatter(); objectStream.Position =0; return (player)BinaryFormatter.Deserialize(objectStream);