-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[System.Management] ManagementObjectSearcher throws MarshalDirectiveException #28840
Comments
@GeertvanHorrik would you like to offer a PR? Right now our focus is on other libraries so it might be some time before we could look at this ourselves. |
I will do it, but only for the endless credits, fame and joy it will bring! But jokes aside, I will try to PR and fix this, might be next week. Is there a time limit? |
No, but the sooner you do it the sooner you have the fix 😉 Please do let us know if you need any help with setup, etc. The materials in the documentation folder in this repo should cover it all. Start with the developer guide. |
Have you tried the newest preview version of the System.Management package? When we added that exception, we also updated System.Management to use char arrays instead of strings for those out parameters. |
@jkoritzinsky just tried 4.6.0-preview.19073.11, but that seems not to work either. Will double check next week, if it doesn't work, I will fix & PR. |
Just forked & build a local copy using the latest sources, and that no longer contains the exception! No need to create a PR, but I learned how to fork & build corefx so still lots of added value 👍 |
@GeertvanHorrik in that case do you have any interest in contributing something else 😃 What are your interests? https://github.com/dotnet/corefx/issues?q=is%3Aopen+is%3Aissue+label%3Aup-for-grabs |
Same issue here |
@godrose it's fixed in the codebase, it just needs a new release (and thus patience ;-) ) |
@danmosemsft Great! Can you share the ETA for the preview 4?
|
I have no idea, I don't work for MS :-) |
@GeertvanHorrik yeah I figured that out )) |
We don't have a date but it shouldn't be too long. Please do post back confirmation it works, when released and you are able. |
@danmosemsft Okay |
@danmosemsft Same issue.
|
@Anipik owns this area and can help check your bits contain this change. Is it possible for you to step into it to check? Symbols should be on Microsoft symbol server. What does "dotnet --info" show? |
@danmosemsft @Anipik
|
OK, and if you check in the debugger, the 3.0 preview 4 binaries are indeed getting loaded? Just want to exclude the obvious stuff. |
@danmosemsft
|
@danmosemsft Is this covered by a unit test? Because it looks like it's easily reproducible, at least at my machine. |
This is covered by unit tests. That’s how I originally found it and fixed it. That’s why it’s weird that you’re still hitting it. It’s been fixed in the source here since the preview 3 timeframe (the fix went in before the CoreCLR change that causes the exception was merged). |
@jkoritzinsky Some kind of cache thing I guess. Few restarts and re-adding the package did the trick. |
It works when I built against a .NET Core 3 project preview 4. Make sure that when installing the NuGet package that the previews checkbox is selected. I initially installed version 4.5, which is over a year old, and which throws the exception. The new version gives the correct number of physical cores and does not throw any errors. |
Great! |
@danmosemsft when will be this shipping to production? |
@nicoriff it will be in 3.0 which will is scheduled for release in Sept, see timeline: https://devblogs.microsoft.com/dotnet/introducing-net-5/ |
I'm now running into this in a WPF .NET Core 3.0 app that includes a .NET Standard 2.0 lib that uses it. |
I think the fix @jkoritzinsky made was 2746a21. @zezba9000 for the avoidance of doubt, perhaps you could use a debugger to see where System.Management.dll is getting loaded from, and use ILSPY or similar to check that change is present? |
Oops never mind. I just needed to update my CoreFX libs to the RC versions to match up with .NET Core 3 stuff. Sorry about that. |
@zezba9000 no problem, glad it's working! Incidentally, now you're here, perhaps you'd be interested in considering a contribution? We have 100's of up for grabs issues. Some are new API ("api-approved" label). |
@danmosemsft I'll take a look! |
Cool, ping any of us on an issue if you're interested. |
Hi, I am using released .net runtime 3.0 and I am still seeing this issue. Can some one clarify where the fix is and how to consume it? |
@danmosemsft thanks very much for the pointers, yes you are right the dll I used didn't contain important classes, I should use dll from this folder runtimes\win\lib\netcoreapp2.0 from v4.6.0 nuget package of system.management. |
Version: 4.5.0
Platform: .NET Core 3.0 (WPF) app
Then I get this exception:
The exact issue is in
ManagementPath.GetWbemPath
:It could be caused by a "wrong" p/invoke here:
https://github.com/dotnet/corefx/blob/000aa2e0740524bdc2db690201e1b3521dd417a3/src/System.Management/src/System/Management/InteropClasses/WMIInterop.cs#L745
The text was updated successfully, but these errors were encountered: