[Mono-dev] [PATCH] Add encoding deserialization proxies forSystem.Text

Miguel de Icaza miguel at ximian.com
Mon Jul 3 20:05:10 EDT 2006


> Implements ISerializable so that they control their own deserialization. 
> This may not be necessary, but ensures that extra fields don't matter at 
> all. And this way serializaton can be prevented by throwing an exception. 
> This may not be necessary because they are internal so are probably never 
> instantiated except by serialization framework.

Was ISerializable there before, or is this an interface that our
implementation would have that might differ from MS?

Btw, your explanation is very useful, could you get the explanation that
you posted here into the modified files?  It will help people reading
the code later.   Or in the ChangeLog :-)

> And they implement IObjectReference so that they can return a different 
> object when deseriealized.
> As a result you will transparently get the right encoding object instead of 
> an exception informing that the type was not found when deserializing 
> objects of these types.
> The above description was detailed but in fact they don't do anything tricky 
> beyond the documented behaviour of GetRealObject:
> "Returns the real object that should be deserialized, rather than the object 
> that the serialized stream specifies."
> http://msdn2.microsoft.com/en-us/library/system.runtime.serialization.iobjectreference.getrealobject.aspx
> So I don't think that they should have more inline documentation than the 
> currently have in comments.
> Note that MS.NET 2.0 probably has similar proxy classes because it 
> deserializes these types to it's own (and different) encoding classes. But 
> as these classes are internal we can solve MS.NET 1.x serialization 
> compatibility as well.
> Also note that to make encoding serialization compatiblity complete (that is 
> that our serialized encoding objects can be deserialized on MS.NET) our 
> internal encoding classes should later be modified to serialize themselves 
> to these proxy classes by calling SerializationInfo.SetType in 
> ISerializable.GetObjectData.
> These proxy class can no way harm Mono because their only effect is that 
> some objects can now be deserialized that were unable to be deserialized 
> previously.

Would you mind including this text in either the encoding files? 

More information about the Mono-devel-list mailing list