I am coding up a Portable Class Library (PCL) that is setup for .NET 4.5, Windows RT and Windows Phone 8.
I want to find the min value in a Dictionary. Searching the web says that MoreLinq is the fastest way to do that.
So I added a reference and it compiled fine.
But I am not sure if I have "Broken Containment" for my PCL.
Will the compiler tell me if I reference something that does not fit in the constraints of the PCL?
Unfortunately the compiler doesn't do such a check for you.
I tried creating a .NET 4 class library using classes from System.Data
namespace which obviously isn't PCL compatible. I had no problems referencing and using it from a portable class library project for .NET 4.5, Windows Store and Windows Phone 8. Even more: I managed to reference this portable library from a Windows Store app, compile it and run it. Of course running the Windows App Certification Kit revealed that and the validation failed.
Your best bet to detect these problems in advance is to add the reference via NuGet which checks whether the package supports your target profile. Of course this requires the NuGet package to be prepared in as pecific way.
For some third party libraries such a package might not be available but it might still be PCL compatible. In such cases I suggest you download the sources and try to create a portable class library with the right targets yourself. This way the compiler will warn you about compatibility problems so long as it only references system assemblies.