-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add hostfxr_get_dotnet_environment_info API #48097
Conversation
Tagging subscribers to this area: @vitek-karas, @agocke Issue DetailsThis PR adds a new hostfxr API to retrieve the installed SDKs and frameworks,
|
src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostFXR.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostFXR.cs
Outdated
Show resolved
Hide resolved
src/installer/tests/Assets/TestProjects/HostApiInvokerApp/HostFXR.cs
Outdated
Show resolved
Hide resolved
Export fn
Validate size of structs Test that result_context isn't modified
What's the current status of the mitigation logic discussed in #46128 and dotnet/sdk#15021? Is that supposed to be part of this API? |
This PR does not address the mitigation logic mentioned in the linked spec, it just adds an API that mimics the behavior of |
Update tests
I created #48180 to track that change (since it should apply to all of the enumeration APIs as well as actual framework resolution). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for the param validation and adding one more test case, this looks good.
int env_sdk_info_size = (sdks.Count > 0) ? Marshal.SizeOf(sdks[0]) : -1; | ||
if (env_sdk_info_size != -1 && (env_sdk_info_size != sdks[0].size)) | ||
throw new Exception($"Size field value of hostfxr_dotnet_environment_sdk_info struct is {sdks[0].size} but {env_sdk_info_size} was expected."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: why not validate this when we add the SDK/framework to their respective lists? Each has this field, so it would make sense to validate all of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @mateoatr!
This PR adds a new hostfxr API to retrieve the installed SDKs and frameworks,
hostfxr_get_dotnet_environment_info
. See #46128 for the design of the API.