[Mono-dev] [PATCH] Add encoding deserialization proxiesforSystem.Text

Kornél Pál kornelpal at gmail.com
Mon Jul 3 20:23:32 EDT 2006

OK, I'll add some inline documentation (i.e. comments) to some of these 
classes. (Today I'm going to sleep.:))

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

All of these classes 
(http://lists.ximian.com/pipermail/mono-patches/2006-July/077142.html) are 
internal so I think this doesn't matter. By the way they are ISerializable 
in MS.NET 2.0 and weren't ISerializable in MS.NET 1.x (but are 
[Serializable]). In Mono they are ISerializable in all of our profiles. But 
as they are internal classes, exact class layout shouldn't be assumed by 


----- Original Message ----- 
From: "Miguel de Icaza" <miguel at ximian.com>
To: "Kornél Pál" <kornelpal at gmail.com>
Cc: <mono-devel-list at lists.ximian.com>
Sent: Tuesday, July 04, 2006 2:05 AM
Subject: Re: [Mono-dev] [PATCH] Add encoding deserialization 

> Hello,
>> 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