Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription report .NET Core 4.0.0.0? #17722

Closed
shanselman opened this issue Jun 28, 2016 · 11 comments
Labels
area-System.Runtime.InteropServices question Answer questions and provide assistance, not an issue with source code or documentation.
Milestone

Comments

@shanselman
Copy link

Why does System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription report .NET Core 4.0.0.0?

/cc @DamianEdwards

@ericstj
Copy link
Member

ericstj commented Jun 28, 2016

/cc @weshaggard @eerhardt
Original discussion here: dotnet/corefx#5210

@Priya91
Copy link
Contributor

Priya91 commented Jun 28, 2016

The version returned is "{FrameworkName} {typeof(object).GetTypeInfo().Assembly.GetName().Version}", it's the build version of mscorlib.dll..

Initially we had the frameworkdescription just return the stack used, and then ASP.NET had a request to return some version info. There wasn't clear guidelines on what the version should be, runtime or framework or the version in the brand name. And we decided to go with this.

@akoeplinger
Copy link
Member

The discussion in dotnet/corefx#4334 (diff) initially started out with preferring to add the FileVersion, but in dotnet/corefx#5210 (diff) it was replaced by Version because UWP doesn't support the FileVersionInfo stuff.

@Priya91 does reading AssemblyInformationalVersion work on UWP? Here's a simple example app:

using System;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var objectVersion = typeof(object).GetTypeInfo().Assembly.GetCustomAttributes().OfType<AssemblyInformationalVersionAttribute>().Single().InformationalVersion;
            var runtimeinfoVersion = typeof(RuntimeInformation).GetTypeInfo().Assembly.GetCustomAttributes().OfType<AssemblyInformationalVersionAttribute>().Single().InformationalVersion;

            Console.WriteLine("object version: " + objectVersion);
            Console.WriteLine("RuntimeInformation version: " + runtimeinfoVersion);
        }
    }
}

This prints

object version: 4.6.24214.01. Commit Hash: abbb8f685929c7aeaa087dae46fedc1bc2af4b17
RuntimeInformation version: 1.0.24212.01. Commit Hash: 9688ddbb62c04189cac4c4a06e31e93377dccd41

... on my .NET Core 1.0 RTM install, which is like 1000x more useful than 4.0.0.0

@DamianEdwards
Copy link
Member

That looks much nicer. Couldn't we make this API implement differently in UWP vs. dotnet.exe host, whether by runtime late-binding or #ifdef, etc.

@ericstj
Copy link
Member

ericstj commented Jun 29, 2016

because UWP doesn't support the FileVersionInfo stuff.

I added support for that.

@borgdylan
Copy link
Contributor

Small Note: The .NET Core version of S.R.IS.RI gets injected into the compilation even if targeting Mono/.NET due to the netstandard1.1 compatibility. This does not only report ".NETCore,Version=4.0.0.0" as described above but it also produces incorrect output when targeting Mono, since the System.Native.so library has to be provided separately.

@ericstj
Copy link
Member

ericstj commented Jun 29, 2016

@borgdylan that issue is discussed here: https://github.com/dotnet/corefx/issues/9012.

@borgdylan
Copy link
Contributor

borgdylan commented Jul 1, 2016

Please, could this API still be able to be included when using full framework and mono. Mono is currently tracking net461 i.e netstandard1.4. I have filed a bug against mono asking for .NET 4.6.2 targeting support which allow the use of netstandard1.5 in the future.

@Priya91 Priya91 closed this as completed Jul 8, 2016
@evil-shrike
Copy link

Why the issue is closed? For .NET Core 2.1 RuntimeInformation.FrameworkDescription still reports incorrect version: ".NET Core: 4.6.26515.07"

>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17134
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.300\

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

@danmoseley
Copy link
Member

Reopening for discussion if needed.

@jkoritzinsky
Copy link
Member

Fixed by dotnet/corefx#35516

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Runtime.InteropServices question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
None yet
Development

No branches or pull requests

10 participants