[Mono-dev] Serialization strategies for compatibility.

Mike Welham mwelham at gmail.com
Tue Jun 6 04:54:42 EDT 2006

> > In general I agree, but ISerializable is a bit of a special case due
> > to remoting. It is unlkiely but conceivable that somewhere in remoting
> > plumbing (in Mono or another tool) somebody might "if(x is
> > ISerializable)...".
> There is no such code in remoting, and even if it was I don't see how it
> could be a problem. Objects serialized with field serialization or with
> the ISerializable interface have the same binary format.

A quick grep shows SoapWriter.cs in
System.Runtime.Serialization.Formatters.Soap is doing this:

private void SerializeObject(object currentObject, long currentObjectId)
     if(currentObject is ISerializable || surrogate != null)
needsSerializationInfo = true;

Also, field serialization will only have the same binary format as an
ISerializable implementation if GetObjectData is careful to make it
the same.

As you say though, this is not an issue if we're careful to ensure
that types where (against API) we add ISerializable we ensure the
serializad binary format matches Microsoft's.

Best Regards


More information about the Mono-devel-list mailing list