Forum Libraries, Components, and Plugins

Azure Mobile Services and Json.NET

Microsoft changed Azure Mobile Services for every platforms(.net 4.5,WP,WinStore) to use Json.NET and this can be found on latest stable version 1.0.2 from Nuget.
I see Xamarin use "Windows.Data.Json" implementation(the version from Component Store), do you plan to release a version that use Json.NET?
I'm asking because I'm writing a cross-platform lib that use Azure Mobile Services and I want to share same code.

Posts

  • EricMaupinEricMaupin USXamarin Team Xamurai

    Microsoft is currently reviewing it before it makes its way to the component store, but it's available in source form here: https://github.com/xamarin/azure-mobile-services/tree/xamarin

  • cristophcristoph ROMember, Beta
    edited November 2013

    I tried to get and compile that version, but if I use Json.NET from Component Store it gives me some errors:

    1. Error CS1061: Type Microsoft.WindowsAzure.MobileServices.MobileServiceJsonSerializerSettings' does not contain a definition forTraceWriter' and no extension method TraceWriter' of typeMicrosoft.WindowsAzure.MobileServices.MobileServiceJsonSerializerSettings' could be found. Are you missing an assembly reference? (CS1061) (Microsoft.WindowsAzure.MobileServices)

    2./../sdk/managed/src/Microsoft.WindowsAzure.MobileServices/Table/Serialization/MobileServiceSerializer.cs(37,37): Error CS1501: No overload for method TryGetValue' takes3' arguments (CS1501) (Microsoft.WindowsAzure.MobileServices)


    3./azure-mobile-services-xamarin/sdk/managed/src/Microsoft.WindowsAzure.MobileServices/Table/Serialization/MobileServiceSerializer.cs(49,49): Error CS1501: No overload for method ToObject' takes2' arguments (CS1501) (Microsoft.WindowsAzure.MobileServices)


    Then I got latest version of Json.NET from here:

    https://github.com/JamesNK/Newtonsoft.Json

    and I used assembly from /Portable4.0/ folder and it works fine at compile time, but on runtime, when deploying to simulator I got this error:

    Could not load 'Newtonsoft.Json' for registration: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
    at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
    at System.Reflection.Assembly.GetTypes () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/Assembly.cs:351
    at MonoTouch.Registrar.OldDynamicRegistrar.RegisterAssembly (System.Reflection.Assembly a) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/OldDynamicRegistrar.cs:67

    This could be due to an outdated assembly kept by the simulator, location: /Users/myuser/Downloads/Json50r8/Bin/Portable/Newtonsoft.Json.dll

    And then when call method that reference Microsoft.WindowsAzure.MobileServices.dll, I got TypeLoadException without signifiant details.

    So question is, what Json.NET implementation you use in latest Xamarin'sMicrosoft.WindowsAzure.MobileServices? or what is cause of this issue?

  • cristophcristoph ROMember, Beta

    Just FYI: after upgrading to latest versions of Xamarin Studio (Version 4.2.1),Xamarin.Android Version: 4.10.1 and Xamarin.iOS Version: 7.0.4.209
    all works fine using Json.NET 5.0.8

Sign In or Register to comment.