Search code examples
.netconcurrencyf#windows-8portable-class-library

Portable class library and .NET ConcurrentDictionary


Looking at http://msdn.microsoft.com/en-us/library/dd287191(v=vs.110).aspx, it seems that ConcurrentDictionary and all of its friends in the System.Collections.Concurrent namespace are available for use in a Portable Class Library.

However, when I create either an F# or C# Portable Class Library, even if I explicitly add a reference to mscorlib.dll, the compilation fails when using ConcurrentDictionary.

Why?


Solution

  • The term "Portable" should be loosely applied right now. When you create the class library project, you get prompted for the targets you want to support. You'll only get ConcurrentDictionary when you select ".NET Framework" and ".NET for Windows Store apps".

    Pick any other and the entire namespace disappears.

    This will get better over time, I'd assume, but Windows Phone 7, XBox and Silverlight are lagging behind right now.