Forum Xamarin.Forms

JsonConvert.DeserializeObject doesn't work in Release mode (Android only)


I have a very strange problem deserializing object from json string.

Everything works good in debug mode, but not in release with the same data. The strangest part is that I use it in several places - one is generic call, and it works, the second one is parsing of the exact object (failing one). I guess it something with linker. If to set linker mode to "none" it resolves the problem, but almost 50 MB apk is not acceptable... I used "link SDK assemblies only" and tried to add almost every assembly to "linking ignore list", nothing helps. If needed I can make simple repro project.




  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭

    Did you add to both PCL and Android project?

  • yes sure. nuget package (6.0.8) is added to every project

  • it was System.Runtime... adding it to linking ignore resolved the problem

  • JamesScottJamesScott USMember ✭✭

    This DID NOT work for me... Any other ideas Xamarin? I'm losing it over here.... Lost a whole afternoon trying different ideas mentioned on different posts, none of them work. Please help!

  • Felix.xFelix.x USMember ✭✭

    You need to put the [Preserve(AllMembers = true)] attribute on any classes that are dynamically generated. This will prevent them from being stripped out.

Sign In or Register to comment.