Permalink
Find file Copy path
1b0c080 Feb 16, 2018
2 contributors

Users who have contributed to this file

@mairaw @terrajobst
33 lines (20 sloc) 1.04 KB

PC002: API not available in .NET Framework 4.6.1

Cause

You're calling an API in .NET Standard that isn't available in the .NET Framework 4.6.1.

Rule description

While the .NET Framework 4.6.1 is treated by NuGet as implementing .NET Standard 2.0, it doesn't fully implement it. This trade-off is explained in the .NET Standard specification.

How to fix violations

You cannot reasonably guard your code against missing APIs. You only have two options:

  1. Not call the affected API.
  2. Not run your code on .NET Framework 4.6.1.

When to suppress warnings

Unless you stop calling the API entirely, you have to suppress this warning as shown in the following example:

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Usage", "PC002:API not available in .NET Framework 4.6.1", Justification = "This library will not run on .NET Framework 4.6.1")]