[Mono-bugs] [Bug 328836] New: System.Web.Script.Serialization doesn' t support Nullable types under Mono

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Sep 27 05:15:32 EDT 2007


https://bugzilla.novell.com/show_bug.cgi?id=328836

           Summary: System.Web.Script.Serialization doesn't support Nullable
                    types under Mono
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: All
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Web
        AssignedTo: mhabersack at novell.com
        ReportedBy: tyler at monkeypox.org
         QAContact: mono-bugs at ximian.com
          Found By: ---


Created an attachment (id=175078)
 --> (https://bugzilla.novell.com/attachment.cgi?id=175078)
Test case for Nullable types with JSON serialization

NET supports deserializing empty values in JSON to Nullable types (reference:
http://lists.ximian.com/pipermail/mono-devel-list/2007-September/024972.html),
but Mono doesn't.

Using Nullable types is required to properly handle possibly empty values that
could/would be serialized out to Int32/Int64 objects if they contained values.

I've attached my modified JsonTest class, 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 @
--------------------------------------


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list