[Moonlight-list] Fwd: [Mono-patches] r147766 - in trunk/mcs/class: System.ServiceModel.Web/System.Runtime.Serialization.Json corlib/System.Collections.Generic

Chris Toshok toshok at gmail.com
Fri Dec 11 13:32:15 EST 2009


It's impossible to deserialize KeyValuePair<TKey,TValue> items *unless* 
we deserialize non-public members - there's simply no other way.  I 
can't imagine this is a 2.1 specific change, but I can try to craft a 
testcase to make sure.  At this point I'd just expect the Serializer to 
skip non-public members when it writes things out.

On 12/11/2009 05:00 AM, Atsushi Eno wrote:
> This patch actually resulted in System.ServiceModel.Web NUnit test
> regressions. At least from the point of CLR view, the TypeMap change is
> wrong, you must not serialize and deserialize nonpublic members. See our
> test results below:
>
> 1)
> MonoTests.System.Runtime.Serialization.Json.DataContractJsonSerializerTest.AlwaysEmitTypeInformation2
> :   #1
>
> 2)
> MonoTests.System.Runtime.Serialization.Json.DataContractJsonSerializerTest.AlwaysEmitTypeInformation3
> :   #1
>
> Make sure that the change is valid in Silverlight WCF scope (a test case
> would be good) and make the change as 2.1 conditional. Or if it is not
> valid, I'll revert the change after waiting for some remedy for your need.
>
> Atsushi Eno
>
>
> -------- Original Message --------
> Subject: 	[Mono-patches] r147766 - in trunk/mcs/class:
> System.ServiceModel.Web/System.Runtime.Serialization.Json
> corlib/System.Collections.Generic
> Date: 	Mon, 7 Dec 2009 02:39:17 -0500 (EST)
> From: 	Chris Toshok<mono-patches-list at lists.ximian.com>
> To: 	mono-patches at lists.ximian.com, ximian.monolist at gmail.com,
> mono-svn-patches-garchive-20758 at googlegroups.com
>
>
>
> Author: toshok
> Date: 2009-12-07 02:39:17 -0500 (Mon, 07 Dec 2009)
> New Revision: 147766
>
> Modified:
>      trunk/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/ChangeLog
>      trunk/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonReader.cs
>      trunk/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/JsonSerializationReader.cs
>      trunk/mcs/class/System.ServiceModel.Web/System.Runtime.Serialization.Json/TypeMap.cs
>      trunk/mcs/class/corlib/System.Collections.Generic/ChangeLog
>      trunk/mcs/class/corlib/System.Collections.Generic/KeyValuePair.cs
> Log:
> in class/corlib/System.Collections.Generic/:
> 2009-12-06  Chris Toshok<toshok at ximian.com>
>
> 	* KeyValuePair.cs: we need setters for Key and Value so they can
> 	be set via reflection from
> 	System.ServiceModel.System.Runtime.Serialization.Json.TypeMap.cs.
>
> in class/System.ServiceModel.Web/System.Runtime.Serialization.Json/:
> 2009-12-06  Chris Toshok<toshok at ximian.com>
>
> 	* JsonSerializationReader.cs (DeserializeGenericCollection): this
> 	is jb's (iirc) patch, actually.  Types subclassing from
> 	ICollection<T>   need to be supported, and since it's an interface
> 	the implementation might be explicit.  So instead of groveling
> 	around in the actual type, we need to dispatch through the
> 	interface's method.
>
> 	* TypeMap.cs (CreateDefaultTypeMap): we need to include non-public
> 	properties, since KeyValuePair items must be able to write to Key
> 	and Value properties.
>
> 	* JsonReader.cs (ReadContent): for builtin values (null, true,
> 	false), use TryReadString instead of individual ReadChar's, since
> 	they aren't reversible if the string didn't match.  In the default
> 	case, if we're LameSilverlightLiseralParser, we need to push back
> 	the current character onto the stream -- this is because for
> 	netflix's AppConfig.json we were parsing "frameRatePolicy" as
> 	"rameRatePolicy" (the 'f' was triggering the "false" parsing).
> 	(class PushBackReader): add this class to unify all the pushing
> 	back of characters we need to do.  1 character (JsonReader's old
> 	"saved_char") isn't enough given that you could have a property
> 	named, e.g., "falsifiable", and we'd need 4 characters worth of
> 	pushback to recognize that correctly.
>
> <snip>
>
> _______________________________________________
> Moonlight-list mailing list
> Moonlight-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/moonlight-list
>    



More information about the Moonlight-list mailing list