[Mono-list] BinaryFormatter Deserialize problem in Mono 1.0.5

Gregg Edghill Gregg Edghill <gregg.edghill@gmail.com>
Mon, 20 Dec 2004 03:56:30 -0500


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