Further adventures in PCL: Profile78 and Json.Net

So, I got a few replies on twitter from the previous post. Most notably from Paul Betts:

@paulcbetts: @fastchicken Yo I'm happy for you and imma let you finish, but Profile78 is the best profile of all time! Of all time!

paulcbetts: @fastchicken (seriously. Use Profile78 for new software)

and

paulcbetts: @fastchicken Profile78 is the most modern one you can pick that includes Xam. It only excludes dead platforms like WP7 and SL5

That pretty much fits the bill for me. I don't care about Windows Phone 7, and I'm surprised Silverlight is even mentioned anymore **evil grin**

Trolling aside, I switched over to Profile78, but all was not well.

paulcbetts: @fastchicken it is broken on Alpha at the moment, move back to Beta

So, back to beta I go (which is fine. I normally use Beta anyway). That allowed me to compile some of the things - TinyMessenger now complains that it doesn't have access to Type.IsAssignableFrom() and Type.GetMethod().

Profile158 has it. Profile78 (which looks like 158 without Silverlight) doesn't. Odd. (Like everything else here, I assume I'm doing something wrong. Or someone at Microsoft was smoking something. I still can't find a decisive list of whats in and out of each profile). Hacky solution is to have BigTed.Core use Profile158, and CodeMania.Core use Profile78.

Profile78 appears to add other problems too. Json.Net or NuGet (or both) want to use an assembly which has dynamic support, by the looks of it:

Could not load 'Newtonsoft.Json' for registration: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

<HintPath>packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll</HintPath>

The fix (as much as it is) is to grab the assembly from the portable-net40+sl5+wp80+win8+monotouch+monoandroid folder, and use it directly. Now I can deserialize Json again!

I have no idea if this is a mis-configured NuGet package for Json.Net, Profile78 messing with things, the Xamarin Studio version of NuGet (I have the latest), or what's causing it. If you know, drop me a line.

Update: and James did:

JamesMontemagno: @fastchicken need to use the component from component store and reference it from PCL. Is easiest.

Off to the Xamarin component store I go. At least that one is easy to do.

So, I think the general outcome for me is:

  • Stick with Beta channel unless I need Alpha (which is normal for me anyway)
  • Use Profile78 until you can't, then try Profile158. Mixing profiles is possible (not sure if it's a good idea tho?)
  • I'd love a list of whats in each profile, at least at a macro level (deeper than "net45 + SL5 + WP8", but not "system.X.Y() is in")
  • Watch which assembly NuGet is pulling in - it might get it wrong. If so, do it manually.
  • Phone a friend. Thanks Paul, Adam, James "Mr Json.Net", Kerry, Stuart and Craig
Nic Wise

Nic Wise

Auckland, NZ