From 0b130fcae4515b429cd145e1f958c1555e36a458 Mon Sep 17 00:00:00 2001 From: Lakshmi Priya Sekar Date: Tue, 5 Jul 2016 12:02:22 -0700 Subject: [PATCH] Respond to PR feedback. Commit migrated from https://github.com/dotnet/corefx/commit/8881947850f325c060b8c7f8879c55c80809e352 --- .../src/System.Runtime.InteropServices.RuntimeInformation.csproj | 2 +- .../InteropServices/RuntimeInformation/RuntimeInformation.cs | 5 ++++- .../src/project.json | 6 +++--- .../tests/DescriptionNameTests.cs | 5 ++--- .../tests/project.json | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj index 0d6e2bd..5ae30b8 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System.Runtime.InteropServices.RuntimeInformation.csproj @@ -12,7 +12,7 @@ System.Runtime.InteropServices.RuntimeInformation 4.0.1.0 {F9DF2357-81B4-4317-908E-512DA9395583} - netstandard1.5 + netstandard1.1 net45 wpa81 win8 diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs index 76a0d48..33fc838 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/RuntimeInformation.cs @@ -23,7 +23,10 @@ namespace System.Runtime.InteropServices { get { - return s_frameworkDescription ?? (s_frameworkDescription = $"{FrameworkName} {FileVersionInfo.GetVersionInfo(typeof(object).GetTypeInfo().Assembly.Location).FileVersion}"); + AssemblyFileVersionAttribute attr = (AssemblyFileVersionAttribute)(typeof(object).GetTypeInfo().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute))); + Debug.Assert(attr != null); + return s_frameworkDescription ?? + (s_frameworkDescription = $"{FrameworkName} {attr.Version}"); } } } diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/project.json b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/project.json index 8650555..2631f64 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/project.json +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/project.json @@ -2,15 +2,15 @@ "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1", "System.Diagnostics.Debug": "4.0.0", - "System.Reflection": "4.1.1-beta-24229-02", + "System.Reflection": "4.0.0", "System.Resources.ResourceManager": "4.0.0", "System.Runtime": "4.0.0", "System.Runtime.InteropServices": "4.0.0", "System.Threading": "4.0.0", - "System.Diagnostics.FileVersionInfo": "4.0.0" + "System.Reflection.Extensions": "4.0.0" }, "frameworks": { - "netstandard1.5": { + "netstandard1.1": { "dependencies": {}, "imports": [ "dotnet5.2" diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs index 3e47bee..02c5a3e 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/DescriptionNameTests.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Runtime.InteropServices; using System.Reflection; -using System.Diagnostics; using Xunit; namespace System.Runtime.InteropServices.RuntimeInformationTests @@ -14,7 +12,8 @@ namespace System.Runtime.InteropServices.RuntimeInformationTests [Fact] public void VerifyRuntimeDebugName() { - string expected = string.Format(".NET Core {0}", FileVersionInfo.GetVersionInfo(typeof(object).GetTypeInfo().Assembly.Location).FileVersion); + AssemblyFileVersionAttribute attr = (AssemblyFileVersionAttribute)(typeof(object).GetTypeInfo().Assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute))); + string expected = string.Format(".NET Core {0}", attr.Version); Assert.Equal(expected, RuntimeInformation.FrameworkDescription); Assert.Same(RuntimeInformation.FrameworkDescription, RuntimeInformation.FrameworkDescription); } diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/project.json b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/project.json index 1cae1e6..47a3abb 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/project.json +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/project.json @@ -4,6 +4,7 @@ "System.Linq.Expressions": "4.1.1-beta-24307-04", "System.ObjectModel": "4.0.13-beta-24307-04", "System.Reflection": "4.1.1-beta-24307-04", + "System.Reflection.Extensions": "4.0.2-beta-24307-04", "System.Runtime": "4.1.1-beta-24307-04", "System.Text.RegularExpressions": "4.2.0-beta-24307-04", "System.Threading.Tasks": "4.0.12-beta-24307-04", @@ -12,8 +13,7 @@ "exclude": "compile" }, "Microsoft.xunit.netcore.extensions": "1.0.0-prerelease-00508-01", - "Microsoft.DotNet.BuildTools.TestSuite": "1.0.0-prerelease-00520-02", - "System.Diagnostics.FileVersionInfo": "4.0.0" + "Microsoft.DotNet.BuildTools.TestSuite": "1.0.0-prerelease-00520-02" }, "frameworks": { "netstandard1.3": {} -- 2.7.4