Linker issues with Json.NET

EricPolereckyEricPolerecky ✭✭USMember ✭✭

There seem to be a few open issues around Json.NET and the linker. Does anyone have a resolution, is there a bug open, is there something I can adjust?

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

When setting the linker to 'don't link' - the build works and the code runs, it can deserialize objects coming in over the network.

when setting the linker to 'Link SDK only' OR 'Link all' the application throws an exception in the link above.

Posts

  • EricPolereckyEricPolerecky ✭✭ USMember ✭✭

    In attempt to resolve this problem I created a linker.txt file with the build action of link description and put pretty much every DLL in my project in that file.

    Here it is for reference.

    <linker> <assembly fullname="mscorlib"></assembly> <assembly fullname="Wantify.Mobile.Shared"></assembly> <assembly fullname="Wantify.Mobile.Droid"></assembly> <assembly fullname="System.Core"></assembly> <assembly fullname="System.Reactive.Linq"></assembly> <assembly fullname="System.Runtime.Serialization"></assembly> <assembly fullname="Newtonsoft.Json"></assembly> <assembly fullname="Akavache.Sqlite3"></assembly> <assembly fullname="Akavache"></assembly> <assembly fullname="System.Reactive.Linq"></assembly> <assembly fullname="System.Reactive.Interfaces"></assembly> <assembly fullname="ReactiveUI"></assembly> <assembly fullname="System.Xml"></assembly> <assembly fullname="AutoMapper"></assembly> <assembly fullname="AutoMapper.Android"></assembly> <assembly fullname="Splat"></assembly> <assembly fullname="Refit"></assembly> <assembly fullname="Ninject"></assembly> <assembly fullname="Polly"></assembly> <assembly fullname="MediaPicker.Forms.Plugin.Abstractions"></assembly> <assembly fullname="ExtendedEntryControl.Forms.Plugin.Abstractions"></assembly> <assembly fullname="Xamarin.Forms.Core"></assembly> <assembly fullname="Xamarin.Forms.Maps"></assembly> </linker>

  • EricPolereckyEricPolerecky ✭✭ USMember ✭✭

    I was able to get passed this issue by telling the linker - when set to link SDK assemblies only - to exclude linking against my application DLLs.

    I am not sure if this is a bug with Link SDK assemblies only - or if I am misunderstanding what Link SDK assemblies only means.

    I believe that it means it won't run the linker against my application specific DLLs - but that is not the case with this error I am seeing.

  • EricPolereckyEricPolerecky ✭✭ USMember ✭✭

    I was incorrect; the problem still exists.

    I have every DLL included in my linker.txt, it's build action is linker resource.
    I have every DLL included in the list of DLLs for the linker to ignore.

    Android linking seems completely hosed.

  • EricPolereckyEricPolerecky ✭✭ USMember ✭✭

    Switching between Beta and Stable channel had no effect. Linker is breaking something with Json.NET. I am going to try older versions of Json.NET as a work around but the issue points to the linker.

  • EricPolereckyEricPolerecky ✭✭ USMember ✭✭

    The issue oddly has nothing to do with the Linker; using the library Refit, I was attempting to create an IList, not a List as the return type from an API call.

    Still tracking down why it works in debug and not release but it's resolved for now.

  • ChristopherSinghChristopherSingh ✭✭ USMember ✭✭

    Any update on a resolution for this issue?

  • EricPolereckyEricPolerecky ✭✭ USMember ✭✭

    Ensure that in your refit API description you are only using concrete types. refit can't infer from the IList what to create.

    Don't use interfaces in your refit API interface description or the responses that come back.

Sign In or Register to comment.