Skip to content

Use System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting - #62903

Merged
jkotas merged 3 commits into
dotnet:mainfrom
marek-safar:attrs8
Dec 25, 2021
Merged

Use System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting#62903
jkotas merged 3 commits into
dotnet:mainfrom
marek-safar:attrs8

Conversation

@marek-safar

@marek-safarmarek-safar commented Dec 16, 2021

Copy link
Copy Markdown
Contributor

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.

@ghostghost added area-Infrastructure-coreclr Only use for closed issues linkable-framework Issues associated with delivering a linker friendly framework labels Dec 16, 2021
@ghost

Copy link
Copy Markdown

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-safarmarek-safar removed their assignment Dec 17, 2021
@jkotas

Copy link
Copy Markdown
Member

This was added in #59962

@jkotasjkotas added area-Interop-mono and removed area-Infrastructure-coreclr Only use for closed issues labels Dec 17, 2021
@lambdageek

Copy link
Copy Markdown
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-safarmarek-safar changed the title Move coreclr specific ComponentActivator hosting dependency to coreclrUse System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHostingDec 22, 2021
@marek-safar

Copy link
Copy Markdown
ContributorAuthor

Updated PR to address the issue differently

@jkotas

Copy link
Copy Markdown
Member

_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

AaronRobinsonMSFT commented Dec 22, 2021

Copy link
Copy Markdown
Member

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

I agree with this name.

@marek-safar

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

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:mainDec 25, 2021
@ghostghost locked as resolved and limited conversation to collaborators Jan 24, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Interop-monolinkable-frameworkIssues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@marek-safar@jkotas@lambdageek@AaronRobinsonMSFT