Skip to content

Using System.Management for Self Contained Apps required specific full .NET version #29663

Description

@theimowski

I'd like to revisit https://github.com/dotnet/corefx/issues/31447

Following code for self contained .NET Core 2.1 console app on Windows 8.1 Pro with .NET 4.5.1:

      use mo = new ManagementObjectSearcher("root\\CIMV2", "select * from win32_computersystem")
      use col = mo.Get()
      col
      |> Seq.cast<ManagementObject>
      |> Seq.head
      |> fun t -> t.GetPropertyValue("totalphysicalmemory")

Experienced following exception:

The type initializer for 'System.Management.WmiNetUtilsHelper' threw an exception. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: ptr

When I update System.Management to latest preview version (4.6.0-preview5.19224.8), the exception changes to:

System.PlatformNotSupportedException: The native library 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\wminet_utils.dll' does not have all required functions. Please, update the .NET Framework.

which is obviously more informative, however .NET Core is supposed to support Windows 8.1 OOTB.
Is this a known issue, or a "won't fix" due to one actually needs recent full .NET Framework to use System.Management?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions