Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (24 sloc) 948 Bytes

PC003: Native API not available in UWP

Cause

You're P/Invoking into a native API from a .NET Standard project or a UWP project but that API isn't available in UWP.

Rule description

Not all Win32 APIs are available in UWP. While calling the API might work when debugging the app, the app store will reject any apps that contain P/Invoke declarations with unsupported APIs.

How to fix violations

Remove the P/Invoke declaration. When targeting .NET Standard, consider cross- targeting for UWP.

When to suppress warnings

The tool might not be able to detect usages of APIs that part of your application. If it's a native module that you deploy with your app, you should suppress the warning.

class NativeMethods
{
    #pragma warning disable PC003 // Native API not available in UWP
    [DllImport("mycode.dll")]
    static extern int MyMethod();
    #pragma warning restore PC003 // Native API not available in UWP
}