Prateek Prateek - 1 month ago 21
ASP.NET (C#) Question

C# IReadOnlyDictionary cannot be found

I'm trying to detect body joints using Kinect. I'm struggling to get even the demo code compiled. The code I wrote is as follows:

Joint head = body.Joints[JointType.Head];
float x = head.Position.X;
float y = head.Position.Y;
float z = head.Position.Z;


I'm getting the body from the body frame detected. The problem is while working with the joint.

The code above gives me the following error:

Error CS7069 Reference to type 'IReadOnlyDictionary<,>' claims it is defined in 'mscorlib', but it could not be found.

Couldn't find anything concrete over the internet. Any help appreciated.

Answer

Looking at the bottom of the MSDN page for IReadOnlyDictionary<TKey,TValue> there is a Version Information section

Version Information

Universal Windows Platform
Available since 8
.NET Framework
Available since 4.5
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1

The version your code is running is lower than the minimum supported version for whatever platform you are building for. Update your codebase to use a newer version of the framework, most likely from the project properties window.