Skip to content

Commit 84680bf

Browse files
authored
Use System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting (#62903)
feature switch to keep native hosting ComponentActivator dependencies
1 parent 0b17270 commit 84680bf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.Shared.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
https://github.com/mono/linker/pull/649 -->
77
<method name=".ctor" />
88
</type>
9+
</assembly>
910

10-
<!-- Native hosting accesses managed methods in the ComponentActivator class.
11-
These are always rooted to ensure native calls get trimmer related errors
12-
but will be trimmed away by the related feature switch -->
11+
<assembly fullname="System.Private.CoreLib" feature="System.Runtime.InteropServices.EnableConsumingManagedCodeFromNativeHosting" featurevalue="true">
12+
<!-- Native hosting accesses managed methods from
13+
https://github.com/dotnet/runtime/blob/bbc898f3e5678135b242faeb6eefd8b24bf04f3c/src/native/corehost/hostpolicy/hostpolicy.cpp#L527-L538
14+
but ComponentActivator is not trimming safe. We persist the methods only when `_EnableConsumingManagedCodeFromNativeHosting` setting
15+
is enabled and only then we show the trimming warnings about possibly missing dependencies.
16+
-->
1317
<type fullname="Internal.Runtime.InteropServices.ComponentActivator">
1418
<method name="LoadAssemblyAndGetFunctionPointer" />
1519
<method name="GetFunctionPointer" />

0 commit comments

Comments
 (0)