diff --git a/docs/workflow/trimming/feature-switches.md b/docs/workflow/trimming/feature-switches.md
index 1171f8fb4b6d2..84f4aad6faba8 100644
--- a/docs/workflow/trimming/feature-switches.md
+++ b/docs/workflow/trimming/feature-switches.md
@@ -20,6 +20,7 @@ configurations but their defaults might vary as any SDK can set the defaults dif
| TBD | System.Threading.ThreadPool.EnableDispatchAutoreleasePool | When set to true, creates an NSAutoreleasePool around each thread pool work item on applicable platforms. |
| CustomResourceTypesSupport | System.Resources.ResourceManager.AllowCustomResourceTypes | Use of custom resource types is disabled when set to false. ResourceManager code paths that use reflection for custom types can be trimmed. |
| EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization | System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization | BinaryFormatter serialization support is trimmed when set to false. |
+| BuiltInComInteropSupport | System.Runtime.InteropServices.BuiltInComInterop.IsSupported | Built-in COM support is trimmed when set to false. |
Any feature-switch which defines property can be set in csproj file or
on the command line as any other MSBuild property. Those without predefined property name
diff --git a/src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.xml b/src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.xml
index 7953cca3a6c10..ef9f087a33e80 100644
--- a/src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.xml
+++ b/src/coreclr/System.Private.CoreLib/src/ILLink/ILLink.Substitutions.xml
@@ -3,5 +3,8 @@
+
+
+
-
\ No newline at end of file
+
diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs
index 015843165977f..1db025ed86581 100644
--- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs
+++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Internal.Runtime.InteropServices
@@ -39,6 +40,7 @@ public partial struct ComActivationContext
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IClassFactory
{
+ [RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
void CreateInstance(
[MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
index d28441194f4a3..37a324445468c 100644
--- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
+++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
@@ -35,6 +35,7 @@ internal struct LICINFO
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IClassFactory2 : IClassFactory
{
+ [RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
new void CreateInstance(
[MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
@@ -62,7 +63,7 @@ public partial struct ComActivationContext
[CLSCompliant(false)]
public static unsafe ComActivationContext Create(ref ComActivationContextInternal cxtInt)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -92,7 +93,7 @@ public static class ComActivator
[RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
public static object GetClassFactoryForType(ComActivationContext cxt)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -126,7 +127,7 @@ public static object GetClassFactoryForType(ComActivationContext cxt)
[RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bool register)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -222,7 +223,7 @@ public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bo
[UnmanagedCallersOnly]
public static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInternal* pCxtInt)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -265,7 +266,7 @@ public static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInte
[UnmanagedCallersOnly]
public static unsafe int RegisterClassForTypeInternal(ComActivationContextInternal* pCxtInt)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -311,7 +312,7 @@ public static unsafe int RegisterClassForTypeInternal(ComActivationContextIntern
[UnmanagedCallersOnly]
public static unsafe int UnregisterClassForTypeInternal(ComActivationContextInternal* pCxtInt)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -364,6 +365,7 @@ private static void Log(string fmt, params object[] args)
Debug.WriteLine(fmt, args);
}
+ [RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
private static Type FindClassType(Guid clsid, string assemblyPath, string assemblyName, string typeName)
{
try
@@ -489,6 +491,7 @@ public static object CreateAggregatedObject(object pUnkOuter, object comObject)
}
}
+ [RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
public void CreateInstance(
[MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
@@ -524,6 +527,7 @@ public LicenseClassFactory(Guid clsid, Type classType)
_classType = classType;
}
+ [RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
public void CreateInstance(
[MarshalAs(UnmanagedType.Interface)] object? pUnkOuter,
ref Guid riid,
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
index 46ea1bb35438c..ddc25611df49a 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.CoreCLR.cs
@@ -196,7 +196,7 @@ private static void PrelinkCore(MethodInfo m)
private static extern void InternalPrelink(RuntimeMethodHandleInternal m);
[DllImport(RuntimeHelpers.QCall)]
- private static extern bool IsComSupportedInternal();
+ private static extern bool IsBuiltInComSupportedInternal();
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern /* struct _EXCEPTION_POINTERS* */ IntPtr GetExceptionPointers();
@@ -236,9 +236,7 @@ private static object PtrToStructureHelper(IntPtr ptr, Type structureType)
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool IsPinnable(object? obj);
- internal static bool IsComSupported { get; } = InitializeIsComSupported();
-
- private static bool InitializeIsComSupported() => IsComSupportedInternal();
+ internal static bool IsBuiltInComSupported { get; } = IsBuiltInComSupportedInternal();
#if TARGET_WINDOWS
///
@@ -296,7 +294,7 @@ public static string GetTypeInfoName(ITypeInfo typeInfo)
// on Marshal for more consistent API surface.
internal static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -443,7 +441,7 @@ public static object GetUniqueObjectForIUnknown(IntPtr unknown)
[SupportedOSPlatform("windows")]
public static IntPtr CreateAggregatedObject(IntPtr pOuter, object o)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -457,7 +455,7 @@ public static IntPtr CreateAggregatedObject(IntPtr pOuter, object o)
[SupportedOSPlatform("windows")]
public static IntPtr CreateAggregatedObject(IntPtr pOuter, T o) where T : notnull
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -484,7 +482,7 @@ public static IntPtr CreateAggregatedObject(IntPtr pOuter, T o) where T : not
[SupportedOSPlatform("windows")]
public static int ReleaseComObject(object o)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -512,7 +510,7 @@ public static int ReleaseComObject(object o)
[SupportedOSPlatform("windows")]
public static int FinalReleaseComObject(object o)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -536,7 +534,7 @@ public static int FinalReleaseComObject(object o)
[SupportedOSPlatform("windows")]
public static object? GetComObjectData(object obj, object key)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -567,7 +565,7 @@ public static int FinalReleaseComObject(object o)
[SupportedOSPlatform("windows")]
public static bool SetComObjectData(object obj, object key, object? data)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -597,7 +595,7 @@ public static bool SetComObjectData(object obj, object key, object? data)
[return: NotNullIfNotNull("o")]
public static object? CreateWrapperOfType(object? o, Type t)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -652,7 +650,7 @@ public static bool SetComObjectData(object obj, object key, object? data)
[SupportedOSPlatform("windows")]
public static TWrapper CreateWrapperOfType(T? o)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -672,7 +670,7 @@ public static TWrapper CreateWrapperOfType(T? o)
[SupportedOSPlatform("windows")]
public static void GetNativeVariantForObject(object? obj, /* VARIANT * */ IntPtr pDstNativeVariant)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -686,7 +684,7 @@ public static void GetNativeVariantForObject(object? obj, /* VARIANT * */ IntPtr
[SupportedOSPlatform("windows")]
public static void GetNativeVariantForObject(T? obj, IntPtr pDstNativeVariant)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -697,7 +695,7 @@ public static void GetNativeVariantForObject(T? obj, IntPtr pDstNativeVariant
[SupportedOSPlatform("windows")]
public static object? GetObjectForNativeVariant(/* VARIANT * */ IntPtr pSrcNativeVariant)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -711,7 +709,7 @@ public static void GetNativeVariantForObject(T? obj, IntPtr pDstNativeVariant
[SupportedOSPlatform("windows")]
public static T? GetObjectForNativeVariant(IntPtr pSrcNativeVariant)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -722,7 +720,7 @@ public static void GetNativeVariantForObject(T? obj, IntPtr pDstNativeVariant
[SupportedOSPlatform("windows")]
public static object?[] GetObjectsForNativeVariants(/* VARIANT * */ IntPtr aSrcNativeVariant, int cVars)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -736,7 +734,7 @@ public static void GetNativeVariantForObject(T? obj, IntPtr pDstNativeVariant
[SupportedOSPlatform("windows")]
public static T[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int cVars)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -764,10 +762,11 @@ public static T[] GetObjectsForNativeVariants(IntPtr aSrcNativeVariant, int c
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern int GetEndComSlot(Type t);
+ [RequiresUnreferencedCode("Built-in COM support is not trim compatible", Url = "https://aka.ms/dotnet-illink/com")]
[SupportedOSPlatform("windows")]
public static object BindToMoniker(string monikerName)
{
- if (!IsComSupported)
+ if (!IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
@@ -780,12 +779,19 @@ public static object BindToMoniker(string monikerName)
return obj;
}
+ // Revist after https://github.com/mono/linker/issues/1989 is fixed
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2050:UnrecognizedReflectionPattern",
+ Justification = "The calling method is annotated with RequiresUnreferencedCode")]
[DllImport(Interop.Libraries.Ole32, PreserveSig = false)]
private static extern void CreateBindCtx(uint reserved, out IBindCtx ppbc);
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2050:UnrecognizedReflectionPattern",
+ Justification = "The calling method is annotated with RequiresUnreferencedCode")]
[DllImport(Interop.Libraries.Ole32, PreserveSig = false)]
private static extern void MkParseDisplayName(IBindCtx pbc, [MarshalAs(UnmanagedType.LPWStr)] string szUserName, out uint pchEaten, out IMoniker ppmk);
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2050:UnrecognizedReflectionPattern",
+ Justification = "The calling method is annotated with RequiresUnreferencedCode")]
[DllImport(Interop.Libraries.Ole32, PreserveSig = false)]
private static extern void BindMoniker(IMoniker pmk, uint grfOpt, ref Guid iidResult, [MarshalAs(UnmanagedType.Interface)] out object ppvResult);
diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
index f645ad15a4073..d01d077b47368 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
@@ -3680,7 +3680,7 @@ private extern object InvokeDispMethod(
Type[] aArgsTypes,
Type retType)
{
- if (!Marshal.IsComSupported)
+ if (!Marshal.IsBuiltInComSupported)
{
throw new NotSupportedException(SR.NotSupported_COM);
}
diff --git a/src/coreclr/vm/ecalllist.h b/src/coreclr/vm/ecalllist.h
index d309500d50f94..eacef79a9b9ab 100644
--- a/src/coreclr/vm/ecalllist.h
+++ b/src/coreclr/vm/ecalllist.h
@@ -758,7 +758,7 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("OffsetOfHelper", MarshalNative::OffsetOfHelper)
QCFuncElement("InternalPrelink", MarshalNative::Prelink)
- QCFuncElement("IsComSupportedInternal", MarshalNative::IsComSupported)
+ QCFuncElement("IsBuiltInComSupportedInternal", MarshalNative::IsBuiltInComSupported)
FCFuncElement("GetExceptionForHRInternal", MarshalNative::GetExceptionForHR)
FCFuncElement("GetDelegateForFunctionPointerInternal", MarshalNative::GetDelegateForFunctionPointerInternal)
FCFuncElement("GetFunctionPointerForDelegateInternal", MarshalNative::GetFunctionPointerForDelegateInternal)
diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp
index 778edeadae63c..b3bf5bde94bd1 100644
--- a/src/coreclr/vm/eeconfig.cpp
+++ b/src/coreclr/vm/eeconfig.cpp
@@ -683,7 +683,7 @@ HRESULT EEConfig::sync()
bLogCCWRefCountChange = true;
fEnableRCWCleanupOnSTAShutdown = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EnableRCWCleanupOnSTAShutdown) != 0);
- m_fBuiltInCOMInteropSupported = Configuration::GetKnobBooleanValue(W("System.Runtime.InteropServices.Marshal.IsComSupported"), true);
+ m_fBuiltInCOMInteropSupported = Configuration::GetKnobBooleanValue(W("System.Runtime.InteropServices.BuiltInComInterop.IsSupported"), true);
#endif // FEATURE_COMINTEROP
#ifdef _DEBUG
diff --git a/src/coreclr/vm/marshalnative.cpp b/src/coreclr/vm/marshalnative.cpp
index 86046fccdcec4..01702b772e127 100644
--- a/src/coreclr/vm/marshalnative.cpp
+++ b/src/coreclr/vm/marshalnative.cpp
@@ -69,10 +69,10 @@ VOID QCALLTYPE MarshalNative::Prelink(MethodDesc * pMD)
END_QCALL;
}
-// IsComSupported
+// IsBuiltInComSupported
// Built-in COM support is only checked from the native side to ensure the runtime
// is in a consistent state
-BOOL QCALLTYPE MarshalNative::IsComSupported()
+BOOL QCALLTYPE MarshalNative::IsBuiltInComSupported()
{
QCALL_CONTRACT;
diff --git a/src/coreclr/vm/marshalnative.h b/src/coreclr/vm/marshalnative.h
index 5971225d22d59..3036d38f5e5e6 100644
--- a/src/coreclr/vm/marshalnative.h
+++ b/src/coreclr/vm/marshalnative.h
@@ -20,7 +20,7 @@ class MarshalNative
{
public:
static VOID QCALLTYPE Prelink(MethodDesc * pMD);
- static BOOL QCALLTYPE IsComSupported();
+ static BOOL QCALLTYPE IsBuiltInComSupported();
//====================================================================
// These methods convert between an HR and and a managed exception.
diff --git a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.Shared.xml b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.Shared.xml
index 5b8326f6ff097..2b5f6ef8918c0 100644
--- a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.Shared.xml
+++ b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Suppressions.Shared.xml
@@ -1,12 +1,6 @@
-
- ILLink
- IL2026
- member
- M:Internal.Runtime.InteropServices.ComActivator.FindClassType(System.Guid,System.String,System.String,System.String)
-
ILLink
IL2072
@@ -19,53 +13,17 @@
member
M:Internal.Runtime.InteropServices.IsolatedComponentLoadContext.Load(System.Reflection.AssemblyName)
-
- ILLink
- IL2050
- member
- M:System.Runtime.InteropServices.Marshal.BindMoniker(System.Runtime.InteropServices.ComTypes.IMoniker,System.UInt32,System.Guid@,System.Object@)
-
-
- ILLink
- IL2050
- member
- M:System.Runtime.InteropServices.Marshal.CreateBindCtx(System.UInt32,System.Runtime.InteropServices.ComTypes.IBindCtx@)
-
-
- ILLink
- IL2050
- member
- M:System.Runtime.InteropServices.Marshal.MkParseDisplayName(System.Runtime.InteropServices.ComTypes.IBindCtx,System.String,System.UInt32@,System.Runtime.InteropServices.ComTypes.IMoniker@)
-
-
- ILLink
- IL2057
- member
- M:Internal.Runtime.InteropServices.ComActivator.ClassRegistrationScenarioForType(Internal.Runtime.InteropServices.ComActivationContext,System.Boolean)
-
ILLink
IL2057
member
M:Internal.Runtime.InteropServices.ComponentActivator.InternalGetFunctionPointer(System.Runtime.Loader.AssemblyLoadContext,System.String,System.String,System.IntPtr)
-
- ILLink
- IL2075
- member
- M:Internal.Runtime.InteropServices.ComActivator.ClassRegistrationScenarioForType(Internal.Runtime.InteropServices.ComActivationContext,System.Boolean)
-
ILLink
IL2075
member
M:Internal.Runtime.InteropServices.ComponentActivator.InternalGetFunctionPointer(System.Runtime.Loader.AssemblyLoadContext,System.String,System.String,System.IntPtr)
-
- ILLink
- IL2077
- member
- M:Internal.Runtime.InteropServices.ComActivator.BasicClassFactory.CreateInstance(System.Object,System.Guid@,System.IntPtr@)
-
diff --git a/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System.Runtime.InteropServices.ComDisabled.Tests.csproj b/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System.Runtime.InteropServices.ComDisabled.Tests.csproj
index f06c7c65cd2e2..e0e9e306d0700 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System.Runtime.InteropServices.ComDisabled.Tests.csproj
+++ b/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System.Runtime.InteropServices.ComDisabled.Tests.csproj
@@ -10,6 +10,6 @@
-
+
diff --git a/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System/Runtime/InteropServices/Marshal/MarshalComDisabledTests.cs b/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System/Runtime/InteropServices/Marshal/MarshalComDisabledTests.cs
index 4a927df56cdf6..8511a4c567071 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System/Runtime/InteropServices/Marshal/MarshalComDisabledTests.cs
+++ b/src/libraries/System.Runtime.InteropServices/tests/ComDisabled/System/Runtime/InteropServices/Marshal/MarshalComDisabledTests.cs
@@ -1,4 +1,6 @@
-//using System.Runtime.InteropServices.Tests.Common;
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
using Xunit;
namespace System.Runtime.InteropServices.Tests