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

Thank you
Copied from original issue: dotnet/aspnetcore#12860
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
Thank you
Copied from original issue: dotnet/aspnetcore#12860