Skip to content

System.Management.MangementScope Exception with Dotnet Core 3 Release #30929

@MakisupaVT

Description

@MakisupaVT

I'm attempting to upgrade a project to Dotnet Core 3 which uses System.Management for WMI calls. When connecting to my MangementScope:

var scope = new ManagementScope(@"\\computer\root\CIMV2", new ConnectionOptions());

Program dies with the exception:

An unhandled exception has occurred while executing the request.
System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'parameter dotnet/corefx#3': Cannot marshal a string by-value with the [Out] attribute.
at System.StubHelpers.StubHelpers.ThrowInteropParamException(Int32 resID, Int32 paramIdx)
at System.Management.ManagementPath.GetWbemPath(IWbemPath wbemPath)
at System.Management.ManagementScope.set_prvpath(ManagementPath value)
at System.Management.ManagementScope..ctor(ManagementPath path, ConnectionOptions options)

I've seen the same Marshal exception on recent Core 3 preview posts that were supposedly fixed, but this issue seems to persist.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions