Skip to content

RuntimeInformation.IsOSPlatform does not actually check OS platform #15112

@natemcmaster

Description

@natemcmaster

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

  1. Download and use a "Windows" version of System.Runtime.InteropServices.RuntimeInformation.dll.
  2. Run on OSX or Linux CoreCLR
  3. Call RuntimeInformation.IsPlatform(OSPlatform.Windows).

This returns true on all platforms, including OSX and Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions