views:

273

answers:

1

I'm attempting to port a C# application to .NET (client server), and am running into issues with serialization.

The Linux client serializes and object, but the Windows server is unable to deserialize it, giving the error:

System.Runtime.Serialization.SerializationException
Field "MarshalByRefObject+__identity" not found in class

Deserialization is done via BinaryFormatter:

BinaryFormatter formatter = new BinaryFormatter();
formatter.Deserialize(data);

The class in question has the Serializable attribute, and inherits from MarshalByRefObject. If I remove the inheritance of MarshalByRefObject, it works fine. Everything works fine in Windows, and so I am assuming this is a Mono specific issue.

Any help/advice would be greatly appreciated ^_^

+4  A: 

Binary serialization relies on private implementation details. In your case, the private field __identity. Because Mono developers do not have access to the private implementation details, these occasionally do not match, and thus binary serialization is not always compatible between .Net and Mono.

Please file a test case with Mono: http://www.mono-project.com/Bugs

To work around this, you can do your own custom serialization for your class.

jpobst
:-) great!!! LoL...
dboarman