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

Kornél Pál kornelpal at gmail.com
Mon Jul 3 19:49:06 EDT 2006


These classes are already in SVN.

They work very simple:

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.

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.

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 1:14 AM
Subject: Re: [Mono-dev] [PATCH] Add encoding deserialization proxies 
forSystem.Text


> Hello,
>
>    I wish the ChangeLog entry for this patch explained how it works, as
> a roadmap for those of us reviewing the patches.
>
> Miguel. 




More information about the Mono-devel-list mailing list