InvalidDataException not available?

I’m trying to throw an InvalidDataException:

using System.IO;

// and in some method...
throw new InvalidDataException("You are a bad, bad boy.");

…and getting:

The type or namespace name `InvalidDataException’ could not be found. Are you missing a directive or an assembly reference?

I see that this exception is available since .Net 2.0, but maybe it is not available in Unity, or maybe I am doing something really dumb. Which one?

Unity has a project setting which is about .net version. I think the default option is set to .Net2 subset which is a smaller framework. You can try to select the full .net option in that setting.

It’s located in Player settings / other / API Compatibility Level