From 90461a223c9704ca0557e8df44b700fbaeafe663 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 16 Mar 2023 18:57:05 -0600 Subject: [PATCH] [release/7.0] Fix System.Management wminet_utils.dll lookup code for arm64 (#83549) * Fix System.Management wminet_utils.dll lookup code for arm64 * Update ManagementScope.cs * Update System.Management.csproj * Update Microsoft.Windows.Compatibility.csproj --------- Co-authored-by: Viktor Hofer --- .../src/Microsoft.Windows.Compatibility.csproj | 2 ++ src/libraries/System.Management/src/System.Management.csproj | 2 ++ .../src/System/Management/ManagementScope.cs | 4 +++- src/libraries/System.Management/tests/WmiTestHelper.cs | 2 +- 4 files changed, 8 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 912ac95801eda..c40fecd680f64 100644 --- a/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj +++ b/src/libraries/Microsoft.Windows.Compatibility/src/Microsoft.Windows.Compatibility.csproj @@ -5,6 +5,8 @@ false true + true + 1 $(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 as well as .NET Standard. diff --git a/src/libraries/System.Management/src/System.Management.csproj b/src/libraries/System.Management/src/System.Management.csproj index 5b66be0b57356..52b27210fa6d7 100644 --- a/src/libraries/System.Management/src/System.Management.csproj +++ b/src/libraries/System.Management/src/System.Management.csproj @@ -9,6 +9,8 @@ annotations true true + 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. diff --git a/src/libraries/System.Management/src/System/Management/ManagementScope.cs b/src/libraries/System.Management/src/System/Management/ManagementScope.cs index 99ad4b32f59d3..052d7605cd8cd 100644 --- a/src/libraries/System.Management/src/System/Management/ManagementScope.cs +++ b/src/libraries/System.Management/src/System/Management/ManagementScope.cs @@ -290,7 +290,9 @@ 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) { diff --git a/src/libraries/System.Management/tests/WmiTestHelper.cs b/src/libraries/System.Management/tests/WmiTestHelper.cs index 0496626b5b186..75460d826d125 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;