What is the proper way to handle error CA1416 for .NET core builds?
问题 Here is my C# code snippet: if (Environment.IsWindows) { _sessionAddress = GetSessionBusAddressFromSharedMemory(); } ... [System.Runtime.Versioning.SupportedOSPlatform("windows")] private static string GetSessionBusAddressFromSharedMemory() { ... } When I run the build, I get an error: error CA1416: 'GetSessionBusAddressFromSharedMemory()' is supported on 'windows' My logic is to invoke the method only when I am on Windows. How do I turn this warning off when building on Ubuntu? Regards. 回答1: