From 0f946a0a0460ff9bc4e430c9715d699366336c81 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 16 Mar 2023 18:27:26 +0100 Subject: [PATCH 1/5] Fix System.Management wminet_utils.dll lookup code for arm64 --- .../src/System/Management/ManagementScope.cs | 6 ++++-- src/libraries/System.Management/tests/WmiTestHelper.cs | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Management/src/System/Management/ManagementScope.cs b/src/libraries/System.Management/src/System/Management/ManagementScope.cs index a1b10722738e2d..63ffe5983bad74 100644 --- a/src/libraries/System.Management/src/System/Management/ManagementScope.cs +++ b/src/libraries/System.Management/src/System/Management/ManagementScope.cs @@ -293,8 +293,10 @@ internal enum APTTYPE static WmiNetUtilsHelper() { RegistryKey netFrameworkSubKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework\"); - string netFrameworkInstallRoot = (string)netFrameworkSubKey?.GetValue("InstallRoot"); - + string netFrameworkInstallRoot = (string)netFrameworkSubKey?.GetValue(RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? + "InstallRootArm64" : + "InstallRoot"); + if (netFrameworkInstallRoot == null) { // In some Windows versions, like Nano Server, the .NET Framework is not installed by default. diff --git a/src/libraries/System.Management/tests/WmiTestHelper.cs b/src/libraries/System.Management/tests/WmiTestHelper.cs index 0496626b5b1863..75460d826d125e 100644 --- a/src/libraries/System.Management/tests/WmiTestHelper.cs +++ b/src/libraries/System.Management/tests/WmiTestHelper.cs @@ -11,7 +11,7 @@ public static class WmiTestHelper private static readonly bool s_isElevated = AdminHelpers.IsProcessElevated(); private static readonly bool s_isWmiSupported = PlatformDetection.IsWindows && - PlatformDetection.IsNotArmNorArm64Process && + PlatformDetection.IsNotArmProcess && PlatformDetection.IsNotWindowsNanoServer && PlatformDetection.IsNotWindowsIoTCore && !PlatformDetection.IsInAppContainer; From c6bd56ac239082662571e4f9fd7a88ef810eea7f Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 16 Mar 2023 19:11:16 +0100 Subject: [PATCH 2/5] Update ManagementScope.cs --- .../System.Management/src/System/Management/ManagementScope.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Management/src/System/Management/ManagementScope.cs b/src/libraries/System.Management/src/System/Management/ManagementScope.cs index 63ffe5983bad74..9bfa3a0992b43b 100644 --- a/src/libraries/System.Management/src/System/Management/ManagementScope.cs +++ b/src/libraries/System.Management/src/System/Management/ManagementScope.cs @@ -296,7 +296,7 @@ static WmiNetUtilsHelper() string netFrameworkInstallRoot = (string)netFrameworkSubKey?.GetValue(RuntimeInformation.ProcessArchitecture == Architecture.Arm64 ? "InstallRootArm64" : "InstallRoot"); - + if (netFrameworkInstallRoot == null) { // In some Windows versions, like Nano Server, the .NET Framework is not installed by default. From 0de8643a05fb3b54c1f1427e7c965cd750224427 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 16 Mar 2023 21:37:57 +0100 Subject: [PATCH 3/5] Update System.Management.csproj --- src/libraries/System.Management/src/System.Management.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj index 996ed58021e598..4ab984ba65ae95 100644 --- a/src/libraries/System.Management/src/System.Management.csproj +++ b/src/libraries/System.Management/src/System.Management.csproj @@ -6,8 +6,8 @@ $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0 true - false - 0 + true + 1 true true Provides access to a rich set of management information and management events about the system, devices, and applications instrumented to the Windows Management Instrumentation (WMI) infrastructure. From 11cb5db9d5573d45ce19d4aeb8c6c8de39a0049a Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 16 Mar 2023 21:38:37 +0100 Subject: [PATCH 4/5] Update Microsoft.Windows.Compatibility.csproj --- .../src/Microsoft.Windows.Compatibility.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj b/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj index 14e1200eb56425..2869bc48244128 100644 --- a/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj +++ b/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj @@ -5,8 +5,8 @@ false true - false - 3 + true + 4 $(NoWarn);NU5128 This Windows Compatibility Pack provides access to APIs that were previously available only for .NET Framework. It can be used from both .NET Core as well as .NET Standard. From 37719222225bca4515786b193b5c33a62eeead09 Mon Sep 17 00:00:00 2001 From: carlossanlop Date: Thu, 16 Mar 2023 14:23:40 -0700 Subject: [PATCH 5/5] Add missing assembly reference. --- src/libraries/System.Management/src/System.Management.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj index 4ab984ba65ae95..aaf1fd7e9e4cdc 100644 --- a/src/libraries/System.Management/src/System.Management.csproj +++ b/src/libraries/System.Management/src/System.Management.csproj @@ -80,6 +80,7 @@ System.Management.SelectQuery +