I would like to use the methods of the Interlocked class in a portable class libraries project and according to the MSDN (here) the Interlocked class is supported in the portable framework. Unforunately it seems that only a part of the Interlocked methods is available. For example I can find neither “Read” nor Exchange(Int64,Int64).
Does anyone know whether they are hiding somewhere else or are just not implemented? And if so, why?
I would like to use the methods of the Interlocked class in a portable
Share
Portable library is a way identifying the common (subset) surface area that is available across the platforms you target, it does not expose or add additional APIs above and beyond this subset. This is why some members differ.
When MSDN says that a given API is supported in portable, it really means that an API is available when you choose a certain combination of platforms. For example, Interlocked.Read in this case is available when choosing .NET Framework & Windows Store apps (and nothing else) on the dialog when creating a new portable class library. Unfortunately, we know this is confusing in the docs and we’re working to improve it in the future.
In the RTM of Visual Studio 2012, and the current RC build of the down-level tools we actually expose the Int64 versions of the Interlocked methods, however, we have a bug where they are exposed when targeting Windows Phone. This is incorrect, they do not work in Windows Phone (they throw NotSupportedException when called).