From 225addf752d4a1690a3a83bdcaa8151886647373 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Thu, 24 Dec 2020 09:22:54 +0100 Subject: [PATCH] Remove ICustomMarshaler from linker descriptor linker can keep the type (#46333) * Remove ICustomMarshaler from linker descriptor linker can keep the type conditionally * Add dependency link to runtime infrastructure code --- .../src/System/Runtime/InteropServices/ICustomMarshaler.cs | 4 ++++ .../netcore/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs index 9b1c0b4..3fc2c73 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ICustomMarshaler.cs @@ -6,6 +6,10 @@ namespace System.Runtime.InteropServices // This the base interface that must be implemented by all custom marshalers. public interface ICustomMarshaler { +#if MONO + // ILLinker marks all methods of this type equaly so the attribute can be on any of them + [System.Diagnostics.CodeAnalysis.DynamicDependency(nameof(Marshal.GetCustomMarshalerInstance), typeof(Marshal))] +#endif object MarshalNativeToManaged(IntPtr pNativeData); IntPtr MarshalManagedToNative(object ManagedObj); diff --git a/src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml b/src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml index b583af7..cf4742d 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml +++ b/src/mono/netcore/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml @@ -569,13 +569,8 @@ - - - - - -- 2.7.4