Skip to content

Use System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting #62903

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

Merged
merged 3 commits into from
Dec 25, 2021

Conversation

marek-safar
Copy link
Contributor

@marek-safar marek-safar commented Dec 16, 2021

feature switch to keep native hosting ComponentActivator dependencies to bring back no trimming warnings for System.Private.Corelib.

System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting is by default disabled (false) when apps are trimmed. Users will need to pass _EnableConsumingManagedCodeFromNativeHosting to re-enable native hosting with ComponentActivator I think that's fine because ComponentActivator is marked as never trimming safe, effectively making trimming + native hosting risky configuration.

@ghost ghost added area-Infrastructure-coreclr linkable-framework Issues associated with delivering a linker friendly framework labels Dec 16, 2021
@ghost ghost assigned marek-safar Dec 16, 2021
@ghost
Copy link

ghost commented Dec 16, 2021

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

null

Author: marek-safar
Assignees: -
Labels:

area-Infrastructure-coreclr

Milestone: -

@marek-safar marek-safar removed their assignment Dec 17, 2021
@jkotas
Copy link
Member

jkotas commented Dec 17, 2021

This was added in #59962

@lambdageek
Copy link
Member

@marek-safar Mono uses these too, to implement the coreclr_create_delegate hosting API. We need it to at least run the DllImportGenerator tests (right now only on desktop mono - mobile mono needs a version of hostpolicy.cpp to run the generator tests).

There's a feature switch EnableConsumingManagedCodeFromNativeHosting that is related to these classes - perhaps we can use it to link this stuff out on mobile and wasm when it isn't needed?

…veHosting

feature switch to keep native hosting ComponentActivator dependencies
@marek-safar marek-safar changed the title Move coreclr specific ComponentActivator hosting dependency to coreclr Use System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting Dec 22, 2021
@marek-safar
Copy link
Contributor Author

Updated PR to address the issue differently

@jkotas
Copy link
Member

jkotas commented Dec 22, 2021

_EnableConsumingManagedCodeFromNativeHosting

Naming nits: We have existing EnableCppCLIHostActivation property: https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options#framework-features-disabled-when-trimming

Would it make sense to call this one EnableNativeHostActivation to follow the naming pattern?

cc @vitek-karas @AaronRobinsonMSFT

@AaronRobinsonMSFT
Copy link
Member

AaronRobinsonMSFT commented Dec 22, 2021

Would it make sense to call this one EnableNativeHostActivation to follow the naming pattern?

I agree with this name.

@marek-safar
Copy link
Contributor Author

I'd prefer to do the msbuild property rename in the follow-up PR as the definition primary lives in sdk and would make sense to change it there first.

@jkotas
Copy link
Member

jkotas commented Dec 22, 2021

I have not realized that this name is in the SDK already. Fixing it up in follow up PR sounds good.

@jkotas jkotas merged commit 84680bf into dotnet:main Dec 25, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Interop-mono linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants