Use Sources RuntimeEnvironment
This commit is contained in:
parent
808ee7e965
commit
7808a47ccc
|
|
@ -9,10 +9,10 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using Microsoft.Extensions.Internal;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Microsoft.Extensions.StackTrace.Sources;
|
||||
|
||||
namespace Microsoft.AspNetCore.Hosting
|
||||
|
|
@ -233,8 +233,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
|
||||
private static string GenerateFooterEncoded()
|
||||
{
|
||||
var environment = PlatformServices.Default.Runtime;
|
||||
var runtimeType = HtmlEncodeAndReplaceLineBreaks(environment.RuntimeType);
|
||||
var runtimeType = HtmlEncodeAndReplaceLineBreaks(Microsoft.Extensions.Internal.RuntimeEnvironment.RuntimeType);
|
||||
var runtimeDisplayName = runtimeType == "CoreCLR" ? ".NET Core" : runtimeType == "CLR" ? ".NET Framework" : "Mono";
|
||||
#if NETSTANDARD1_3
|
||||
var systemRuntimeAssembly = typeof(System.ComponentModel.DefaultValueAttribute).GetTypeInfo().Assembly;
|
||||
|
|
@ -243,13 +242,28 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
#else
|
||||
var clrVersion = HtmlEncodeAndReplaceLineBreaks(Environment.Version.ToString());
|
||||
#endif
|
||||
var runtimeArch = HtmlEncodeAndReplaceLineBreaks(environment.RuntimeArchitecture);
|
||||
var runtimeArch = HtmlEncodeAndReplaceLineBreaks(RuntimeInformation.ProcessArchitecture.ToString());
|
||||
var currentAssembly = typeof(StartupExceptionPage).GetTypeInfo().Assembly;
|
||||
var currentAssemblyVersion = currentAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
|
||||
currentAssemblyVersion = HtmlEncodeAndReplaceLineBreaks(currentAssemblyVersion);
|
||||
|
||||
var os = HtmlEncodeAndReplaceLineBreaks(environment.OperatingSystem);
|
||||
var osVersion = HtmlEncodeAndReplaceLineBreaks(environment.OperatingSystemVersion);
|
||||
var osName = string.Empty;
|
||||
var osVersion = string.Empty;
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
osName = OSPlatform.Windows.ToString();
|
||||
osVersion = Microsoft.Extensions.Internal.RuntimeEnvironment.OperatingSystemVersion;
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
osName = OSPlatform.Linux.ToString();
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
osName = OSPlatform.OSX.ToString();
|
||||
}
|
||||
var os = HtmlEncodeAndReplaceLineBreaks(osName);
|
||||
osVersion = HtmlEncodeAndReplaceLineBreaks(osVersion);
|
||||
|
||||
return string.Format(CultureInfo.InvariantCulture, _errorFooterFormatString, runtimeDisplayName, runtimeArch, clrVersion,
|
||||
currentAssemblyVersion, os, osVersion);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
"Microsoft.Extensions.DependencyInjection": "1.0.0-*",
|
||||
"Microsoft.Extensions.Logging": "1.0.0-*",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-*",
|
||||
"Microsoft.Extensions.RuntimeEnvironment.Sources": {
|
||||
"type": "build",
|
||||
"version": "1.0.0-*"
|
||||
},
|
||||
"Microsoft.Extensions.StackTrace.Sources": {
|
||||
"type": "build",
|
||||
"version": "1.0.0-*"
|
||||
|
|
@ -39,7 +43,8 @@
|
|||
"type": "build"
|
||||
},
|
||||
"System.Diagnostics.DiagnosticSource": "4.0.0-*",
|
||||
"System.Reflection.Metadata": "1.3.0-*"
|
||||
"System.Reflection.Metadata": "1.3.0-*",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue