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

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


One more thing:

These classes are proxy classes so users will not see them at all because 
they are instantiated by the serialization framework that calls 
IObjectReference.GetRealObject and the user will only see the returned 
object as the deserialized object. So the only way to see instances of these 
classes is when you instantiate them using Activator.

Kornél

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


> 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 users.
>
> 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