Skip to content

System.Management.dll not working on win-arm64 #81400

@SteveL-MSFT

Description

@SteveL-MSFT

Description

This dll works on x64, but fails to load the required native dll on win-arm64. This is impacting the Get-HotFix cmdlet in PowerShell 7.

Reproduction Steps

var scope = new System.Management.ManagementScope(@"root\cimv2");
scope.Connect();

Expected behavior

No error (nothing will happen with this snippet)

Actual behavior

It appears to be trying to load the native library from Framework64 when it should be loading it from FrameworkArm64:

Unhandled exception. System.TypeInitializationException: The type initializer for 'System.Management.WmiNetUtilsHelper' threw an exception.
 ---> System.ComponentModel.Win32Exception (193): Failed to load required native library 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\wminet_utils.dll'.
   at System.Management.WmiNetUtilsHelper..cctor()
   --- End of inner exception stack trace ---
   at System.Management.MTAHelper.IsNoContextMTA()
   at System.Management.MTAHelper.CreateInMTA(Type type)
   at System.Management.ManagementPath.CreateWbemPath(String path)
   at System.Management.ManagementPath..ctor(String path)
   at System.Management.ManagementScope..ctor(String path)
   at Program.<Main>$(String[] args) in C:\Users\slee\test\wmi\Program.cs:line 1

Regression?

Don't know

Known Workarounds

No response

Configuration

.NET 7
Windows 11
arm64

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions