-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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.WbemDefPath doesn't work with trimming #61960
Comments
NativeAOT compiler |
WbemDefPath is built-in COM. This doesn't work with trimming in general and NativeAOT implies trimming. It will have to be converted to ComWrappers. |
Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @sbomer, @joperezr Issue DetailsDescriptionNativeAOT (the trimming?) breaks the body of System.Management.WbemDefPath..ctor():
I'm reporting this here since NativeAOT will be moved into this repo anyway and it's probably a trimming issue? in which case it belongs to this repo. Reproduction StepsIn nativeAOT project: ManagementClass managementClass = new ManagementClass("Win32_BaseBoard");
var instances = managementClass.GetInstances();
foreach (var obj in instances)
{
//...
} In C# project call the export function of the nativeAOT project which executes the code above. Expected behaviorNo exception Actual behaviorException Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationIt's a windows x64 DLL project publishing using
|
Unfortunately not, see dotnet/runtimelab#1748 |
If anyone is looking to pick this up and needs an example of how to convert to COMWrappers, here are the PRs that converted System.Drawing.Common to use COMWrappers. They may be useful to get started on how to do it. Also, check out the docs here: https://docs.microsoft.com/en-us/dotnet/standard/native-interop/tutorial-comwrappers |
are there any workarounds on how to make system.management to work with nativeaot for now? |
It's the same problem as #78038 that was recently closed but had a couple other people. System.Management needs to be converted to ComWrappers. It's starting to be a pretty popular request. Cc @jkoritzinsky if this is something that could be addressed with the COM source generator for .NET 8. |
i managed to workaround using powershell.exe with Get-WmiObject command but indeed being able to do more advanced querying and not needing to parse the text output manually is preferred. |
Description
NativeAOT (the trimming?) breaks the body of System.Management.WbemDefPath..ctor():
I'm reporting this here since NativeAOT will be moved into this repo anyway and it's probably a trimming issue? in which case it belongs to this repo.
Reproduction Steps
In nativeAOT project:
In C# project call the export function of the nativeAOT project which executes the code above.
Expected behavior
No exception
Actual behavior
Exception
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
It's a windows x64 DLL project publishing using
/p:NativeLib=Shared
, I'm using NativeAOT compiler nuget version6.0.0-*
The text was updated successfully, but these errors were encountered: