DataContractJsonSerializer has problems with deserializing double values in 7.0.7

OliverFreitagOliverFreitag DEMember, Beta

if I try to deserialize a complex structure containing double values in the version 7.0.7 there is a problem.
Every double like 12.34 will be converted to 1234 in the resulting class.
If I use version 7.0.6 the same code is working as expected.

I suppose, it has something todo with the culture settings. I'm on a german iPhone.

I'm using the following code.

var ms = new MemoryStream (Encoding.Unicode.GetBytes (json));
var serializer = new DataContractJsonSerializer (typeof(T));
var obj = (T)serializer.ReadObject (ms);
ms.Close ();
ms.Dispose ();
return obj;

Posts

  • ClockAppDevClockAppDev NLMember ✭✭
    edited March 2014

    Having the same issues here.
    In addition to that, ever since 7.0.7 the values 0 and 1 are not recognized as booleans anymore when deserializing, while in 7.0.6 they still were.

    Reverted to 7.0.6 for the time being.

  • OliverFreitagOliverFreitag DEMember, Beta
    edited March 2014

    The problem here is the region value on the device. With US it is working with DE (or I suppose NL) it is not.
    May be this helps.
    But it is still a bug.
    https://bugzilla.xamarin.com/show_bug.cgi?id=18131

  • OliverFreitagOliverFreitag DEMember, Beta

    https://bugzilla.xamarin.com/show_bug.cgi?id=18131#

    This bug is not fixed in the current version.

    Xamarin.iOS
    Version: 7.2.0.2 (Business Edition)
    Hash: 58c3efa
    Branch:
    Build date: 2014-10-03 18:02:26-0400

    Any idea when this will work properly?

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    The fix is in Mono 3.4.0. That version isn't available with any Xamarin release yet. The latest stable Xamarin release of Mono is 3.2.6.

  • SebastienPouliotSebastienPouliot CAXamarin Team Xamurai

    @OliverFreitag the current XI 7.2.1 beta release has the commit specified in the bug report (which means it will be in the stable 7.2.1 once released).

Sign In or Register to comment.