Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

DNX on OSX/Linux loads the wrong System.Runtime.InteropServices.RuntimeInformation package #2594

@natemcmaster

Description

@natemcmaster

System.Runtime.InteropServices.RuntimeInformation.IsPlatform(OSPlatform.Windows) always returns true, even on OSX and Linux.

Repro
Run this on different platforms. It will always print "Windows".

{
    "dependencies": {},
    "frameworks": {
        "dnxcore50":{
            "dependencies": {
                "System.Console":"4.0.0-*",
                "System.Runtime.InteropServices.RuntimeInformation": "4.0.0-*"
            }
        }
    }
}
using System;
using System.Runtime.InteropServices;

namespace Test
{
    public class Program
    {
        public void Main(string[] args)
        {
            if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Console.WriteLine("Windows");
            }
            if(RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                Console.WriteLine("Darwin");
            }
            if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Console.WriteLine("Linux");
            }
        }
    }
}

Versions

1.0.0-beta8-15545    coreclr x64  darwin       
and
1.0.0-beta8-15545    coreclr x64  linux      

System.Runtime.InteropServices.RuntimeInformation 4.0.0-beta-23231

Pulling from https://www.myget.org/F/aspnetlitedev/api/v2

This is related to #2387. Our myget feed publishes a package of System.Runtime.InteropServices.RuntimeInformation that includes the Windows version of the dll. This gets loaded at runtime, and thus misinforms the IsPlatform API about which OS is actually running.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions