dotnet/corefx#1999 added API's which creates an API contract to detect OS platform (#1017).
However, the implementation of dotnet/corefx#1999 does not work correctly. The current implementation does not actually examine the current OS at runtime. This means System.Runtime.InteropServices.RuntimeInformation.IsPlatform can lie if the wrong package is used at runtime (see aspnet/Microsoft.Data.Sqlite#121, for instance.)
Repro
- Download and use a "Windows" version of
System.Runtime.InteropServices.RuntimeInformation.dll.
- Run on OSX or Linux CoreCLR
- Call
RuntimeInformation.IsPlatform(OSPlatform.Windows).
This returns true on all platforms, including OSX and Linux.