Skip to content

System.Management does not work with .net core 3.0 prev 7 #30498

@Pilchie

Description

@Pilchie

From @HolyOne on Sunday, August 4, 2019 10:10:32 AM

I have an existing class using System.Management code which works.

I created a .net core 3 web app (I run on visual studio with Administrator permisions)
I get marshal error when I try to connect WMI at the first line.

This is the line I call
DNS = new ManagementScope (@"\\localhost\root\MicrosoftDNS") ;

This is the error I get
System.Runtime.InteropServices.MarshalDirectiveException: 'Cannot marshal 'parameter dotnet/corefx#3': Cannot marshal a string by-value with the [Out] attribute.'

I do not use any win32 dll call or out parameter in my code so I thought it must be an internal error on System.Management or .net core 3 preview

image

Thank you

Copied from original issue: dotnet/aspnetcore#12860

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