diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/Dependencies/RequiresInCopyAssembly.cs b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/Dependencies/RequiresInCopyAssembly.cs new file mode 100644 index 00000000000000..c0b8f7be11e170 --- /dev/null +++ b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/Dependencies/RequiresInCopyAssembly.cs @@ -0,0 +1,123 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Diagnostics.CodeAnalysis; +using System.Runtime.CompilerServices; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.RequiresCapability.Dependencies +{ + public class RequiresInCopyAssembly + { + public RequiresInCopyAssembly () + { + } + + [RequiresUnreferencedCode ("Message for --Method--")] + [RequiresAssemblyFiles ("Message for --Method--")] + [RequiresDynamicCode ("Message for --Method--")] + public void Method () + { + } + + [RequiresUnreferencedCode ("Message for --UncalledMethod--")] + [RequiresAssemblyFiles ("Message for --UncalledMethod--")] + [RequiresDynamicCode ("Message for --UncalledMethod--")] + public void UncalledMethod () + { + } + + [RequiresUnreferencedCode ("Message for --MethodCalledThroughReflection--")] + [RequiresAssemblyFiles ("Message for --MethodCalledThroughReflection--")] + [RequiresDynamicCode ("Message for --MethodCalledThroughReflection--")] + static void MethodCalledThroughReflection () + { + } + + public int UnusedProperty { + [RequiresUnreferencedCode ("Message for --getter UnusedProperty--")] + [RequiresAssemblyFiles ("Message for --getter UnusedProperty--")] + [RequiresDynamicCode ("Message for --getter UnusedProperty--")] + get { return 42; } + + [RequiresUnreferencedCode ("Message for --setter UnusedProperty--")] + [RequiresAssemblyFiles ("Message for --setter UnusedProperty--")] + [RequiresDynamicCode ("Message for --setter UnusedProperty--")] + set { } + } + + class UnusedBaseType + { + [RequiresUnreferencedCode ("Message for --UnusedBaseTypeCctor--")] + [RequiresAssemblyFiles ("Message for --UnusedBaseTypeCctor--")] + [RequiresDynamicCode ("Message for --UnusedBaseTypeCctor--")] + static UnusedBaseType () + { + } + + [RequiresUnreferencedCode ("Message for --UnusedVirtualMethod1--")] + [RequiresAssemblyFiles ("Message for --UnusedVirtualMethod1--")] + [RequiresDynamicCode ("Message for --UnusedVirtualMethod1--")] + public virtual void UnusedVirtualMethod1 () + { + } + + [RequiresUnreferencedCode ("Message for --UnusedVirtualMethod2--")] + [RequiresAssemblyFiles ("Message for --UnusedVirtualMethod2--")] + [RequiresDynamicCode ("Message for --UnusedVirtualMethod2--")] + public virtual void UnusedVirtualMethod2 () + { + } + } + + class UnusedDerivedType : UnusedBaseType + { + [RequiresUnreferencedCode ("Message for --UnusedVirtualMethod1--")] + [RequiresAssemblyFiles ("Message for --UnusedVirtualMethod1--")] + [RequiresDynamicCode ("Message for --UnusedVirtualMethod1--")] + public override void UnusedVirtualMethod1 () + { + } + + // Should not warn when this is part of a copied assembly. + public override void UnusedVirtualMethod2 () + { + } + } + + interface IUnusedInterface + { + [RequiresUnreferencedCode ("Message for --IUnusedInterface.UnusedMethod--")] + [RequiresAssemblyFiles ("Message for --IUnusedInterface.UnusedMethod--")] + [RequiresDynamicCode ("Message for --IUnusedInterface.UnusedMethod--")] + public void UnusedMethod (); + } + + class UnusedImplementationClass : IUnusedInterface + { + [RequiresUnreferencedCode ("Message for --UnusedImplementationClass.UnusedMethod--")] + [RequiresAssemblyFiles ("Message for --UnusedImplementationClass.UnusedMethod--")] + [RequiresDynamicCode ("Message for --UnusedImplementationClass.UnusedMethod--")] + public void UnusedMethod () + { + } + } + + public interface IBaseInterface + { + [RequiresUnreferencedCode ("Message for --IBaseInterface.MethodInBaseInterface--")] + [RequiresAssemblyFiles ("Message for --IBaseInterface.MethodInBaseInterface--")] + [RequiresDynamicCode ("Message for --IBaseInterface.MethodInBaseInterface--")] + void MethodInBaseInterface (); + } + + public interface IDerivedInterface : IBaseInterface + { + [RequiresUnreferencedCode ("Message for --IDerivedInterface.MethodInDerivedInterface--")] + [RequiresAssemblyFiles ("Message for --IDerivedInterface.MethodInDerivedInterface--")] + [RequiresDynamicCode ("Message for --IDerivedInterface.MethodInDerivedInterface--")] + void MethodInDerivedInterface (); + } + } +} diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresCapabilityFromCopiedAssembly.cs b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresCapabilityFromCopiedAssembly.cs new file mode 100644 index 00000000000000..653f794882e861 --- /dev/null +++ b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresCapabilityFromCopiedAssembly.cs @@ -0,0 +1,29 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; +using Mono.Linker.Tests.Cases.RequiresCapability.Dependencies; + +namespace Mono.Linker.Tests.Cases.RequiresCapability +{ + [SetupLinkerAction ("copy", "lib")] + [SetupCompileBefore ("lib.dll", new[] { "Dependencies/RequiresInCopyAssembly.cs" })] + [KeptAllTypesAndMembersInAssembly ("lib.dll")] + [LogDoesNotContain ("IL2026")] + [LogDoesNotContain ("IL3002")] + [LogDoesNotContain ("IL2027")] + public class RequiresCapabilityFromCopiedAssembly + { + public static void Main () + { + Test (); + } + + [Kept] + static void Test () + { + var x = new RequiresInCopyAssembly (); + } + } +} diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresCapabilityReflectionAnalysisEnabled.cs b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresCapabilityReflectionAnalysisEnabled.cs new file mode 100644 index 00000000000000..856c3d4a8ba718 --- /dev/null +++ b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresCapabilityReflectionAnalysisEnabled.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Helpers; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.RequiresCapability +{ + [ExpectedNoWarnings] + public class RequiresCapabilityReflectionAnalysisEnabled + { + [LogContains ("-- DynamicallyAccessedMembersEnabled --")] + [LogContains ("-- ReflectionPattern --")] + [LogContains ("-- DynamicallyAccessedMembersOnGenericsEnabled --")] + public static void Main () + { + TestRequiresAttributeWithDynamicallyAccessedMembersEnabled (); + TestRequiresAttributeWithReflectionPattern (); + TestRequiresAttributeWithDynamicallyAccessedMembersOnGenericsEnabled (); + TestRequiresAndDynamicallyAccessedMembers.Test (); + } + + [Kept] + [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))] + [RequiresUnreferencedCode ("-- DynamicallyAccessedMembersEnabled --")] + static void TestRequiresAttributeWithDynamicallyAccessedMembersEnabled () + { + typeof (TypeWithPublicFieldsAccessed).RequiresPublicFields (); + } + + [Kept] + class TypeWithPublicFieldsAccessed + { + [Kept] + public int _publicField; + + private int _privateField; + } + + [Kept] + [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))] + [RequiresUnreferencedCode ("-- ReflectionPattern --")] + static void TestRequiresAttributeWithReflectionPattern () + { + typeof (TypeWithMethodAccessed).GetMethod ("PublicMethod"); + } + + [Kept] + class TypeWithMethodAccessed + { + [Kept] + public void PublicMethod () { } + + public void PublicMethod2 () { } + } + + [Kept] + [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))] + [RequiresUnreferencedCode ("-- DynamicallyAccessedMembersOnGenericsEnabled --")] + static void TestRequiresAttributeWithDynamicallyAccessedMembersOnGenericsEnabled () + { + TypeRequiresPublicFields.Method (); + MethodRequiresPublicFields (); + } + + [Kept] + class TypeRequiresPublicFields< + [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + T> + { + [Kept] + public static void Method () { } + } + + [Kept] + class TypeWithPublicFieldsForGenericType + { + [Kept] + public int _publicField; + + private int _privateField; + } + + [Kept] + static void MethodRequiresPublicFields< + [KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + T> () + { + } + + [Kept] + class TypeWithPublicFieldsForGenericMethod + { + [Kept] + public int _publicField; + + private int _privateField; + } + + [Kept] + class TestRequiresAndDynamicallyAccessedMembers + { + [Kept] + [KeptAttributeAttribute (typeof (RequiresUnreferencedCodeAttribute))] + [RequiresUnreferencedCode ("--- RequiresAndPublicMethods ---")] + static void RequiresAndPublicMethods ( + [KeptAttributeAttribute(typeof(DynamicallyAccessedMembersAttribute))] + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] + Type type) + { + // This should not produce a warning since the method is annotated with Requires + type.RequiresPublicFields (); + + // This will still "work" in that it will apply the PublicFields requirement onto the specified type + typeof (TestRequiresAndDynamicallyAccessedMembers).RequiresPublicFields (); + } + + [Kept] + public void PublicInstanceMethod () { } + + [Kept] + public static void PublicStaticMethod () { } + + static void PrivateInstanceMethod () { } + + [Kept] + public static int PublicStaticField; + + static int PrivateStaticField; + + [Kept] + [ExpectedWarning ("IL2026", "--- RequiresAndPublicMethods ---")] + public static void Test () + { + RequiresAndPublicMethods (typeof (TestRequiresAndDynamicallyAccessedMembers)); + } + } + } +} \ No newline at end of file diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs new file mode 100644 index 00000000000000..775b581878b0ee --- /dev/null +++ b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs @@ -0,0 +1,79 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.RequiresCapability +{ + [SkipKeptItemsValidation] + [ExpectedNoWarnings] + class RequiresViaDataflow + { + // Base/Derived and Implementation/Interface differs between linker and analyzer https://github.com/dotnet/linker/issues/2533 + [ExpectedWarning ("IL2026", "--DynamicallyAccessedTypeWithRequires.MethodWithRequires--")] + [ExpectedWarning ("IL2026", "TypeWhichOverridesMethod.VirtualMethodRequires()", "--TypeWhichOverridesMethod.VirtualMethodRequires--", ProducedBy = ProducedBy.Analyzer | ProducedBy.NativeAot)] + [ExpectedWarning ("IL2026", "BaseType.VirtualMethodRequires()", "--BaseType.VirtualMethodRequires--")] + public static void Main () + { + TestDynamicallyAccessedMembersWithRequires (typeof (DynamicallyAccessedTypeWithRequires)); + TestDynamicallyAccessedMembersWithRequires (typeof (TypeWhichOverridesMethod)); + TestRequiresInDynamicDependency (); + } + + class BaseType + { + [RequiresUnreferencedCode ("Message for --BaseType.VirtualMethodRequires--")] + [RequiresAssemblyFiles ("Message for --BaseType.VirtualMethodRequires--")] + [RequiresDynamicCode ("Message for --BaseType.VirtualMethodRequires--")] + public virtual void VirtualMethodRequires () + { + } + } + + class TypeWhichOverridesMethod : BaseType + { + [RequiresUnreferencedCode ("Message for --TypeWhichOverridesMethod.VirtualMethodRequires--")] + [RequiresAssemblyFiles ("Message for --TypeWhichOverridesMethod.VirtualMethodRequires--")] + [RequiresDynamicCode ("Message for --TypeWhichOverridesMethod.VirtualMethodRequires--")] + public override void VirtualMethodRequires () + { + } + } + + public class DynamicallyAccessedTypeWithRequires + { + [RequiresUnreferencedCode ("Message for --DynamicallyAccessedTypeWithRequires.MethodWithRequires--")] + public void MethodWithRequires () + { + } + } + + static void TestDynamicallyAccessedMembersWithRequires ( + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) + { + } + + [RequiresUnreferencedCode ("Message for --RequiresInDynamicDependency--")] + [RequiresAssemblyFiles ("Message for --RequiresInDynamicDependency--")] + [RequiresDynamicCode ("Message for --RequiresInDynamicDependency--")] + static void RequiresInDynamicDependency () + { + } + + [ExpectedWarning ("IL2026", "--RequiresInDynamicDependency--")] + [ExpectedWarning ("IL2026", "--RequiresInDynamicDependency--", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL3002", "--RequiresInDynamicDependency--", ProducedBy = ProducedBy.Analyzer | ProducedBy.NativeAot)] + [ExpectedWarning ("IL3050", "--RequiresInDynamicDependency--", ProducedBy = ProducedBy.Analyzer | ProducedBy.NativeAot)] + [DynamicDependency ("RequiresInDynamicDependency")] + static void TestRequiresInDynamicDependency () + { + RequiresInDynamicDependency (); + } + } +} diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs new file mode 100644 index 00000000000000..873751ae09df22 --- /dev/null +++ b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs @@ -0,0 +1,66 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; +using Mono.Linker.Tests.Cases.RequiresCapability.Dependencies; + +namespace Mono.Linker.Tests.Cases.RequiresCapability +{ + [SetupLinkerAction ("copy", "lib")] + [SetupCompileBefore ("lib.dll", new[] { "Dependencies/RequiresInCopyAssembly.cs" })] + [KeptAllTypesAndMembersInAssembly ("lib.dll")] + [SkipKeptItemsValidation] + // Annotated members on a copied assembly should not produce any warnings + // unless directly called or referenced through reflection. + [LogDoesNotContain ("--UncalledMethod--")] + [LogDoesNotContain ("--getter UnusedProperty--")] + [LogDoesNotContain ("--setter UnusedProperty--")] + [LogDoesNotContain ("--UnusedBaseTypeCctor--")] + [LogDoesNotContain ("--UnusedVirtualMethod1--")] + [LogDoesNotContain ("--UnusedVirtualMethod2--")] + [LogDoesNotContain ("--IUnusedInterface.UnusedMethod--")] + [LogDoesNotContain ("--UnusedImplementationClass.UnusedMethod--")] + // [LogDoesNotContain ("UnusedVirtualMethod2")] // https://github.com/dotnet/linker/issues/2106 + + [ExpectedNoWarnings] + class RequiresWithCopyAssembly + { + [ExpectedWarning ("IL2026", "--IDerivedInterface.MethodInDerivedInterface--")] + [ExpectedWarning ("IL2026", "--IBaseInterface.MethodInBaseInterface--")] + public static void Main () + { + TestRequiresInMethodFromCopiedAssembly (); + TestRequiresThroughReflectionInMethodFromCopiedAssembly (); + TestRequiresInDynamicallyAccessedMethodFromCopiedAssembly (typeof (RequiresInCopyAssembly.IDerivedInterface)); + } + + [ExpectedWarning ("IL2026", "--Method--")] + [ExpectedWarning ("IL3002", "--Method--", ProducedBy = ProducedBy.Analyzer | ProducedBy.NativeAot)] + [ExpectedWarning ("IL3050", "--Method--", ProducedBy = ProducedBy.Analyzer | ProducedBy.NativeAot)] + static void TestRequiresInMethodFromCopiedAssembly () + { + var tmp = new RequiresInCopyAssembly (); + tmp.Method (); + } + + [ExpectedWarning ("IL2026", "--MethodCalledThroughReflection--")] + static void TestRequiresThroughReflectionInMethodFromCopiedAssembly () + { + typeof (RequiresInCopyAssembly) + .GetMethod ("MethodCalledThroughReflection", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic) + .Invoke (null, new object[0]); + } + + static void TestRequiresInDynamicallyAccessedMethodFromCopiedAssembly ( + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] Type type) + { + } + } +} diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/SuppressRequires.cs b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/SuppressRequires.cs new file mode 100644 index 00000000000000..fbffac37ad9028 --- /dev/null +++ b/src/coreclr/tools/aot/Mono.Linker.Tests.Cases/RequiresCapability/SuppressRequires.cs @@ -0,0 +1,160 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Helpers; + +namespace Mono.Linker.Tests.Cases.RequiresCapability +{ + [SkipKeptItemsValidation] + [ExpectedNoWarnings] + class SuppressRequires + { + public static void Main () + { + SuppressMethodBodyReferences.Test (); + SuppressGenericParameters.Test (); + } + + class SuppressMethodBodyReferences + { + static Type _unknownType; + static Type GetUnknownType () => null; + + [RequiresUnreferencedCode ("Message for --MethodWithRequires--")] + [RequiresAssemblyFiles ("Message for --MethodWithRequires--")] + [RequiresDynamicCode ("Message for --MethodWithRequires--")] + static void MethodWithRequires () + { + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)] + static Type _requiresPublicConstructors; + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestMethodWithRequires () + { + // Normally this would warn, but with the attribute on this method it should be auto-suppressed + MethodWithRequires (); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestParameter () + { + _unknownType.RequiresPublicMethods (); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestReturnValue () + { + GetUnknownType ().RequiresPublicEvents (); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestField () + { + _requiresPublicConstructors = _unknownType; + } + + [UnconditionalSuppressMessage ("Trimming", "IL2026")] + [UnconditionalSuppressMessage ("SingleFile", "IL3002")] + [UnconditionalSuppressMessage ("AOT", "IL3050")] + public static void Test () + { + TestMethodWithRequires (); + TestParameter (); + TestReturnValue (); + TestField (); + } + } + + [ExpectedNoWarnings] + class SuppressGenericParameters + { + static Type _unknownType; + + static void GenericMethodRequiresPublicMethods<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] T> () { } + + class GenericTypeRequiresPublicFields<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> { } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestGenericMethod () + { + GenericMethodRequiresPublicMethods (); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestGenericMethodMismatch () + { + GenericMethodRequiresPublicMethods (); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestGenericType () + { + new GenericTypeRequiresPublicFields (); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestMakeGenericTypeWithStaticTypes () + { + typeof (GenericTypeRequiresPublicFields<>).MakeGenericType (typeof (TUnknown)); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestMakeGenericTypeWithDynamicTypes () + { + typeof (GenericTypeRequiresPublicFields<>).MakeGenericType (_unknownType); + } + + [RequiresUnreferencedCode ("")] + [RequiresAssemblyFiles ("")] + [RequiresDynamicCode ("")] + static void TestMakeGenericMethod () + { + typeof (SuppressGenericParameters) + .GetMethod ("GenericMethodRequiresPublicMethods", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static) + .MakeGenericMethod (typeof (TPublicProperties)); + } + + [UnconditionalSuppressMessage ("Trimming", "IL2026")] + [UnconditionalSuppressMessage ("SingleFile", "IL3002")] + [UnconditionalSuppressMessage ("AOT", "IL3050")] + public static void Test () + { + TestGenericMethod (); + TestGenericMethodMismatch (); + TestGenericType (); + TestMakeGenericTypeWithStaticTypes (); + TestMakeGenericTypeWithDynamicTypes (); + TestMakeGenericMethod (); + } + } + + class TestType { } + } +}