[Mono-list] BinaryFormatter Deserialize problem in Mono 1.0.5

Lluis Sanchez lluis@ximian.com
Mon, 20 Dec 2004 10:23:07 +0100


Without a test case that reproduces the problem it is very difficult
help.

On dl, 2004-12-20 at 03:56 -0500, Gregg Edghill wrote:
> Hey, I am trying to serialize an object for transfer via socket.  The
> problem I am facing is that I get the following error in Deserialize
> method invoke
> 
> System.InvalidCastException: Cannot cast from source type to destination type.
> in <0x0018e> MultiCast.Listener:StartListening ()
> in <0x0002c> MultiCast.Server:Main (string[])
> 
> The cast looks as follows:
> 
> socket.Receive(b);
> MemoryStream stream1 = new MemoryStream(b);
> IFormatter f = new BinaryFormatter();
> Message md = (Message) f.Deserialize(stream1);
> 
> I was wondering if someone could help with this because I read the
> documentation on Mono and the BinaryFormatter is supposed to be
> implemented.  Oh, almost forgot, I can serialize and deserialize to a
> filestream without a problem.
> 
> Best regards,
> Gregg
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list