1

Closed

Portable version of Json.NET not compatible with WP7 version

description

The WP7 version of Json.NET isn't strong name signed. The portable version is. This means that portable code using Json.NET won't work with the WP7 version of Json.NET. Unfortunately I think fixing this (by strong name signing the WP7 version) would break compatibility for existing WP7 packages built against the unsigned version.


Create a new Windows Phone 7.1 application
Add a new Portable Class Library project to the solution. For target frameworks, choose .NET 4.5, SL4, WP7.5, and .NET for Windows Store apps
Reference the Portable Class Library project from the Windows Phone project.
Reference the Json.NET NuGet package from BOTH projects
Add code to use Json.NET (ie new JObject()) in the portable project and call it from the Phone project (ie in the MainPage constructor)
Run the app in the WP7 (not WP8) emulator

Expected: code runs successfully
Actual: System.TypeLoadException: File or assembly name 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30AD4FE6B2A6AEED', or one of its dependencies, was not found.

file attachments

Closed Jan 3, 2013 at 9:47 PM by JamesNK
Why are you reopening this? All Json.NET assemblies in NuGet are signed.

comments

JamesNK wrote Oct 30, 2012 at 3:22 AM

I think you can go from unsigned to signed without anything breaking. There are signed dlls for WP and Silverlight in the download from CodePlex. Try them in the bin directory and see what happens.

JamesNK wrote Jan 3, 2013 at 4:12 PM

I tested and I got some weird results but I think that WP is happy with a signed dll replacing an unsigned one.



** Closed by JamesNK 11/3/2012 6:29 PM

dsplaisted wrote Jan 3, 2013 at 4:12 PM

The problem isn't with a signed DLL replacing an unsigned one, it's the other way around. A portable library referencing the NuGet package would have a referenced to a signed version of Json.NET. If a WP7 app also references the NuGet package, it would get the unsigned version, and when the portable library tries to load the signed version it will fail.

This is also discussed here: https://nuget.codeplex.com/workitem/2790