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

Kornél Pál kornelpal at gmail.com
Tue Jul 4 05:10:06 EDT 2006


Hi,

I added a brief description of the proxy classes as comments for people who 
know what serialization is but didn't see IObjectReference before:
http://lists.ximian.com/pipermail/mono-patches/2006-July/077146.html

And filed two bugs so that the modifications required for serialization 
compatibility will not be forgotten:
http://bugzilla.ximian.com/show_bug.cgi?id=78757
http://bugzilla.ximian.com/show_bug.cgi?id=78758

Kornél

----- 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 
proxiesforSystem.Text


> 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