diff --git a/docs/workflow/trimming/feature-switches.md b/docs/workflow/trimming/feature-switches.md index 36ac156f4f86b..71f819b656f85 100644 --- a/docs/workflow/trimming/feature-switches.md +++ b/docs/workflow/trimming/feature-switches.md @@ -8,18 +8,19 @@ configurations but their defaults might vary as any SDK can set the defaults dif | MSBuild Property Name | AppContext Setting | Description | |-|-|-| +| BuiltInComSupport | System.Runtime.InteropServices.Marshal.IsBuiltInComSupported | In-built COM support is trimmed when set to false. | +| 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. | | DebuggerSupport | System.Diagnostics.Debugger.IsSupported | Any dependency that enables better debugging experience to be trimmed when set to false | +| EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization | System.ComponentModel.TypeConverter.EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization | BinaryFormatter serialization support is trimmed when set to false. | | EnableUnsafeUTF7Encoding | System.Text.Encoding.EnableUnsafeUTF7Encoding | Insecure UTF-7 encoding is trimmed when set to false | | EnableUnsafeBinaryFormatterSerialization | System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization | BinaryFormatter serialization support is trimmed when set to false | | EventSourceSupport | System.Diagnostics.Tracing.EventSource.IsSupported | Any EventSource related code or logic is trimmed when set to false | | InvariantGlobalization | System.Globalization.Invariant | All globalization specific code and data is trimmed when set to true | -| UseSystemResourceKeys | System.Resources.UseSystemResourceKeys | Any localizable resources for system assemblies is trimmed when set to true | | HttpActivityPropagationSupport | System.Net.Http.EnableActivityPropagation | Any dependency related to diagnostics support for System.Net.Http is trimmed when set to false | | HttpNativeHandler | System.Net.Http.UseNativeHttpHandler | HttpClient uses by default platform native implementation of HttpMessageHandler if set to true. | | StartupHookSupport | System.StartupHookProvider.IsSupported | Startup hooks are disabled when set to false. Startup hook related functionality can be trimmed. | +| UseSystemResourceKeys | System.Resources.UseSystemResourceKeys | Any localizable resources for system assemblies is trimmed when set to true | | 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. | 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..5516021ec3659 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/ComActivator.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs index 598d7b809e89c..0fc5afdf025ef 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 @@ -23,6 +23,7 @@ namespace Internal.Runtime.InteropServices [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, @@ -49,6 +50,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, @@ -96,7 +98,7 @@ public struct ComActivationContext public static unsafe ComActivationContext Create(ref ComActivationContextInternal cxtInt) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - if (!Marshal.IsComSupported) + if (!Marshal.IsBuiltInComSupported) { throw new NotSupportedException(SR.NotSupported_COM); } @@ -132,7 +134,7 @@ public static class ComActivator public static object GetClassFactoryForType(ComActivationContext cxt) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - if (!Marshal.IsComSupported) + if (!Marshal.IsBuiltInComSupported) { throw new NotSupportedException(SR.NotSupported_COM); } @@ -170,7 +172,7 @@ public static object GetClassFactoryForType(ComActivationContext cxt) public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bool register) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - if (!Marshal.IsComSupported) + if (!Marshal.IsBuiltInComSupported) { throw new NotSupportedException(SR.NotSupported_COM); } @@ -270,7 +272,7 @@ public static void ClassRegistrationScenarioForType(ComActivationContext cxt, bo public static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInternal* pCxtInt) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - if (!Marshal.IsComSupported) + if (!Marshal.IsBuiltInComSupported) { throw new NotSupportedException(SR.NotSupported_COM); } @@ -317,7 +319,7 @@ public static unsafe int GetClassFactoryForTypeInternal(ComActivationContextInte public static unsafe int RegisterClassForTypeInternal(ComActivationContextInternal* pCxtInt) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - if (!Marshal.IsComSupported) + if (!Marshal.IsBuiltInComSupported) { throw new NotSupportedException(SR.NotSupported_COM); } @@ -367,7 +369,7 @@ public static unsafe int RegisterClassForTypeInternal(ComActivationContextIntern public static unsafe int UnregisterClassForTypeInternal(ComActivationContextInternal* pCxtInt) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION - if (!Marshal.IsComSupported) + if (!Marshal.IsBuiltInComSupported) { throw new NotSupportedException(SR.NotSupported_COM); } @@ -432,6 +434,7 @@ private static void Log(string fmt, params object[] args) #endif } + [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) { #if FEATURE_COMINTEROP_UNMANAGED_ACTIVATION @@ -583,6 +586,7 @@ public static object CreateAggregatedObject(object pUnkOuter, object comObject) #endif } + [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, @@ -632,6 +636,7 @@ public LicenseClassFactory(Guid clsid, Type classType) #endif } + [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..3e0cad94ed05d 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,9 @@ private static object PtrToStructureHelper(IntPtr ptr, Type structureType) [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool IsPinnable(object? obj); - internal static bool IsComSupported { get; } = InitializeIsComSupported(); + internal static bool IsBuiltInComSupported { get; } = InitializeIsBuiltInComSupported(); - private static bool InitializeIsComSupported() => IsComSupportedInternal(); + private static bool InitializeIsBuiltInComSupported() => IsBuiltInComSupportedInternal(); #if TARGET_WINDOWS /// @@ -296,7 +296,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 +443,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 +457,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 +484,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 +512,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 +536,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 +567,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 +597,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 +652,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 +672,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 +686,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 +697,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 +711,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 +722,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 +736,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 +764,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 +781,18 @@ public static object BindToMoniker(string monikerName) return obj; } + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2050:UnrecognizedReflectionPattern", + Justification = "The calling method is guarded")] [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 guarded")] [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 guarded")] [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..dafcb7eb419d2 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.Marshal.IsBuiltInComSupported"), 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/Microsoft.VisualBasic.Core/src/ILLink/ILLink.Suppressions.xml b/src/libraries/Microsoft.VisualBasic.Core/src/ILLink/ILLink.Suppressions.xml index 2092add4c502a..b68b103222fce 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/src/ILLink/ILLink.Suppressions.xml +++ b/src/libraries/Microsoft.VisualBasic.Core/src/ILLink/ILLink.Suppressions.xml @@ -85,6 +85,12 @@ member M:Microsoft.VisualBasic.Interaction.CreateObject(System.String,System.String) + + ILLink + IL2026 + member + M:Microsoft.VisualBasic.Interaction.GetObject(System.String,System.String) + ILLink IL2072 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 28c2c77dacc28..98d69c13582db 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 @@ -3,13 +3,13 @@ true $(NetCoreAppCurrent) true - - true + + true - + 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..cc86af6a9bac9 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 @@ -7,16 +9,16 @@ namespace System.Runtime.InteropServices.Tests public partial class MarshalComDisabledTests { [Fact] - public void GetTypeFromCLSID_ThrowsNotSupportedException() + public void CreateAggregatedObject_ThrowsNotSupportedException() { - Assert.Throws(() => Marshal.GetTypeFromCLSID(Guid.Empty)); + object value = new object(); + Assert.Throws(() => Marshal.CreateAggregatedObject(IntPtr.Zero, value)); } [Fact] - public void CreateAggregatedObject_ThrowsNotSupportedException() + public void GetTypeFromCLSID_ThrowsNotSupportedException() { - object value = new object(); - Assert.Throws(() => Marshal.CreateAggregatedObject(IntPtr.Zero, value)); + Assert.Throws(() => Marshal.GetTypeFromCLSID(Guid.Empty)); } [Fact]