[Mono-dev] Replicating System.Web.Script.Serialization bugs

Konstantin Triger kostat at mainsoft.com
Mon Oct 1 04:42:16 EDT 2007


Hey Tyler,

If you need this urgently, please provide a fix.
If not - it will be somewhere in my todo list and will be fixed in a couple of weeks.

Regards,
Konstantin Triger

> -----Original Message-----
> From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-
> bounces at lists.ximian.com] On Behalf Of R. Tyler Ballance
> Sent: Thursday, September 27, 2007 11:26 AM
> To: mono-devel-list at lists.ximian.com
> Subject: Re: [Mono-dev] Replicating System.Web.Script.Serialization bugs
> 
> 
> On Sep 26, 2007, at 12:39 AM, Andrés G. Aragoneses [ knocte ] wrote:
> 
> > R. Tyler Ballance escribió:
> >> [...]
> >> Without providing compatibility for MS.NET, the only alternatives
> >> seem to be some application specific hacks, either with crazy
> >> properties as mentioned above, or using Nullable types (which we
> >> don't yet support in Mono right?)
> >
> > Hey, I think Mono has support for Nullables since much time ago.
> 
> Unfortunately, I tried this in Mono, and our
> System.Web.Script.Serialization barfs on Nullable types :(
> 
> Fortunately, .NET doesn't! Alas there is hope :)
> 
> I've attached my modified JsonTest class (attached), and here's the
> output:
> 
> Microsoft .NET 2.0.5:
> --------------------------------------
> Testing for empty values in JSON with this string:
> {"int_key" : ""}
> int_key =
> 
> --------------------------------------
> 
> Mono version 1.2.5 (/trunk/ r86375)
> --------------------------------------
> [mono] \w @ mono JsonTest.exe
> Testing for empty values in JSON with this string:
> {"int_key" : ""}
> 
> Unhandled Exception: System.InvalidCastException: Unknown target
> conversion type
>    at System.Convert.ToType (System.Object value, System.Type
> conversionType, IFormatProvider provider) [0x00000]
>    at System.Convert.ChangeType (System.Object value, System.Type
> conversionType) [0x00000]
>    at
> System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType
> (System.Type type, System.Object obj) [0x00000]
>    at
> System.Web.Script.Serialization.JavaScriptSerializer.ConvertToObject
> (IDictionary`2 dict, System.Type type) [0x00000]
>    at
> System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType
> (System.Type type, System.Object obj) [0x00000]
>    at
> System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType
> [JsonObject] (System.Object obj) [0x00000]
>    at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize
> [JsonObject] (System.String input) [0x00000]
>    at JsonTests.JsonTest.Main (System.String[] args) [0x00000]
> [mono] \w @
> --------------------------------------
> 
> I've also reported the bug here: https://bugzilla.novell.com/
> show_bug.cgi?id=328836
> 
> 
> Cheers
> 




More information about the Mono-devel-list mailing list