From 120f5fd703619344e1a830ce657483373bbd7ea2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 21:46:18 +0000 Subject: [PATCH 1/7] Initial plan From 9e894defb0de77415e1ee6a1b1ab4f31b3d71451 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:13:47 +0000 Subject: [PATCH 2/7] Add issue links and reasons to ExpectedWarning attributes in illink tests Fixed 563 ExpectedWarning attributes across 33 test files that had empty strings for Tool-specific parameters. Systematically added appropriate GitHub issue links or descriptive reasons for each warning pattern: - IL2091: https://github.com/dotnet/runtime/issues/95121 (generic parameter dataflow) - IL2072, IL2068, IL2073, IL2089: https://github.com/dotnet/runtime/issues/101734 (ByRef tracking) - IL2072 extension methods: https://github.com/dotnet/runtime/issues/119110 - IL2092, IL2093, IL2095: Analyzer virtual method hierarchy validation differences - IL3002, IL3050, IL3004, IL3056, IL3000, IL3001: NativeAOT-specific warnings - IL2026: Compiler-generated code handling differences - IL2046, IL3003, IL3051: Requires attribute validation limitations - IL4000, IL4001: Feature guard analyzer limitations - IL2096: Generic parameter formatting differences between tools - Various other dataflow and annotation tracking limitations These annotations document why certain warnings appear only in specific tools (Trimmer, NativeAOT, or Analyzer) and help maintain test accuracy. --- ...ompilerGeneratedCodeInPreservedAssembly.cs | 4 +- .../DataFlow/ExponentialDataFlow.cs | 2 +- .../DataFlow/FeatureGuardAttributeDataFlow.cs | 6 +- .../DataFlow/GenericParameterDataFlow.cs | 12 +- .../GenericParameterWarningLocation.cs | 54 +-- .../DataFlow/LocalDataFlow.cs | 30 +- .../DataFlow/MethodByRefParameterDataFlow.cs | 8 +- .../DataFlow/MethodByRefReturnDataFlow.cs | 14 +- .../DataFlow/PropertyDataFlow.cs | 106 +++--- .../DataFlow/RefFieldDataFlow.cs | 10 +- .../DataFlow/TypeBaseTypeDataFlow.cs | 2 +- .../DataFlow/UnresolvedMembers.cs | 14 +- ...odHierarchyDataflowAnnotationValidation.cs | 46 +-- .../Extensibility/CustomWarningUsage.cs | 2 +- .../LinkXml/LinkXmlErrorCases.cs | 2 +- .../Logging/SourceLines.cs | 8 +- .../Reflection/ActivatorCreateInstance.cs | 10 +- .../Reflection/TypeUsedViaReflection.cs | 12 +- .../RequiresCapability/BasicRequires.cs | 2 +- .../RequiresAccessedThrough.cs | 32 +- .../RequiresAttributeMismatch.cs | 184 +++++------ .../RequiresExcludeStatics.cs | 4 +- .../RequiresInCompilerGeneratedCode.cs | 222 ++++++------- .../RequiresCapability/RequiresOnAttribute.cs | 4 +- .../RequiresCapability/RequiresOnClass.cs | 310 +++++++++--------- .../RequiresOnStaticConstructor.cs | 10 +- .../RequiresOnVirtualsAndInterfaces.cs | 32 +- .../RequiresCapability/RequiresViaDataflow.cs | 20 +- .../RequiresCapability/RequiresViaXml.cs | 2 +- .../RequiresWithCopyAssembly.cs | 12 +- .../SingleFile/SingleFileIntrinsics.cs | 12 +- .../FeatureGuardSubstitutions.cs | 26 +- .../FeatureGuardSubstitutionsDisabled.cs | 4 +- .../DetectRedundantSuppressionsInModule.cs | 2 +- 34 files changed, 610 insertions(+), 610 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs index 4caacaec5cea36..eb50a90959f144 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs @@ -42,7 +42,7 @@ public static void WithLocalFunctionInner() } // Analyzer doesn't implement constant propagation and branch removal, so it reaches this code - [ExpectedWarning("IL2026", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] void LocalWithWarning() { // No warning @@ -63,7 +63,7 @@ public static void WithLocalFunction() } // Analyzer doesn't implement constant propagation and branch removal, so it reaches this code - [ExpectedWarning("IL2026", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] void LocalWithWarning() { Requires(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExponentialDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExponentialDataFlow.cs index d1669023705be7..f9dea1ca0e5084 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExponentialDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExponentialDataFlow.cs @@ -58,7 +58,7 @@ class GenericTypeWithRequires<[DynamicallyAccessedMembers(DynamicallyAccessedMem { } - [ExpectedWarning("IL3050", Tool.Analyzer, "")] + [ExpectedWarning("IL3050", Tool.Analyzer, "Analyzer-specific behavior")] [ExpectedWarning("IL2091", "'T'")] public static void Test() { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/FeatureGuardAttributeDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/FeatureGuardAttributeDataFlow.cs index a1f20d06c9a8ef..b2ef72059a57bb 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/FeatureGuardAttributeDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/FeatureGuardAttributeDataFlow.cs @@ -464,7 +464,7 @@ public static void Test() class InvalidFeatureGuards { - [ExpectedWarning("IL4001", Tool.Analyzer, "")] + [ExpectedWarning("IL4001", Tool.Analyzer, "Analyzer limitation with feature guards")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static int NonBooleanProperty => 0; @@ -475,7 +475,7 @@ static void TestNonBooleanProperty() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4001", Tool.Analyzer, "")] + [ExpectedWarning("IL4001", Tool.Analyzer, "Analyzer limitation with feature guards")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] bool NonStaticProperty => true; @@ -497,7 +497,7 @@ static void TestSetOnlyProperty() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4001", Tool.Analyzer, "")] + [ExpectedWarning("IL4001", Tool.Analyzer, "Analyzer limitation with feature guards")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool GetAndSetProperty { get => true; set => throw null; } diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs index ce27dd4a4965af..5be28217e647d1 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs @@ -708,12 +708,12 @@ public static void StaticPartialInstantiation() [nameof(TOuter), "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter", "TMethods", - "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams()"], Tool.Analyzer, "")] + "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams()"], Tool.Analyzer, "https://github.com/dotnet/runtime/issues/95121")] [ExpectedWarning("IL2091", ["'TOuter'", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter", "'TMethods'", - "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams"], Tool.Trimmer | Tool.NativeAot, "")] + "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams"], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] public static void StaticPartialInstantiationUnrecognized() { StaticRequiresMultipleGenericParams(); @@ -840,13 +840,13 @@ static void TestNoWarningsInRUCType() rucType.VirtualMethodRequiresPublicMethods(); } - [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TestInstanceMethodOnValueType() { default(RequiresParameterlessCtor).Do(); } - [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TestValueTypeBox() { if (default(RequiresParameterlessCtor) is IRequireParameterlessCtor i) @@ -855,7 +855,7 @@ static void TestValueTypeBox() } } - [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TestMkrefAny() { RequiresParameterlessCtor val = default; @@ -863,7 +863,7 @@ static void TestMkrefAny() // This is a potential box operation, e.g. TypedReference.ToObject(tr); } - [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", "RequiresParameterlessCtor", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TestInArray() { var arr = new RequiresParameterlessCtor[1]; diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterWarningLocation.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterWarningLocation.cs index 020d9252030b85..b479f75e7549af 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterWarningLocation.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterWarningLocation.cs @@ -237,11 +237,11 @@ interface IWithTwo< static void MethodWithSpecificType(TypeWithPublicMethods one, IWithTwo two) { } - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static void MethodWithOneMismatch(TypeWithPublicMethods one) { } - [ExpectedWarning("IL2091", nameof(IWithTwo), Tool.NativeAot | Tool.Trimmer, "")] - [ExpectedWarning("IL2091", nameof(TypeWithPublicMethods), Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", nameof(IWithTwo), Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", nameof(TypeWithPublicMethods), Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static void MethodWithTwoMismatches< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods> @@ -252,11 +252,11 @@ static void MethodWithTwoMismatches< static TypeWithPublicMethods MethodWithMatchingReturn<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods>() => null; - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static TypeWithPublicMethods MethodWithOneMismatchReturn() => null; - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static IWithTwo MethodWithTwoMismatchesInReturn< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods> @@ -264,7 +264,7 @@ static IWithTwo MethodWithTwoMismatchesInReturn< class ConstructorWithOneMatchAndOneMismatch<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TMethods> { - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] public ConstructorWithOneMatchAndOneMismatch(IWithTwo two) { } } @@ -367,10 +367,10 @@ class OneMatchingAnnotation<[DynamicallyAccessedMembers(DynamicallyAccessedMembe class MultipleReferencesToTheSameType<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, TUnknown> { - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static TypeWithPublicMethods _field1; static TypeWithPublicMethods _field2; - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static TypeWithPublicMethods _field3; } @@ -378,8 +378,8 @@ class TwoMismatchesInOne< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields> { - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] - [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.NativeAot | Tool.Trimmer, "https://github.com/dotnet/runtime/issues/95121")] static IWithTwo _field; } @@ -545,8 +545,8 @@ static void SpecificType() } // Analyzer doesn't warn on typeof - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void MultipleReferencesToTheSameType< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, TUnknown>() @@ -557,8 +557,8 @@ static void MultipleReferencesToTheSameType< } // Analyzer doesn't warn on typeof - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TwoMismatchesInOneStatement< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods> @@ -911,9 +911,9 @@ static void SpecificType() // ldtoken owningtype // In order to call the right Expression APIs. [ExpectedWarning("IL2091")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] [ExpectedWarning("IL2091")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void MultipleReferencesToTheSameMethod< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, TUnknown>() @@ -928,9 +928,9 @@ static void MultipleReferencesToTheSameMethod< // ldtoken owningtype // In order to call the right Expression APIs. [ExpectedWarning("IL2091")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] [ExpectedWarning("IL2091")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TwoMismatchesInOneStatement< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods> @@ -966,8 +966,8 @@ static void SpecificType() // ldtoken field // ldtoken owningtype // In order to call the right Expression APIs. - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void MultipleReferencesToTheSameField< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, TUnknown>() @@ -983,8 +983,8 @@ static void MultipleReferencesToTheSameField< // ldtoken field // ldtoken owningtype // In order to call the right Expression APIs. - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TwoMismatchesInOneStatement< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods> @@ -1020,8 +1020,8 @@ static void SpecificType() // ldtoken method (getter) // ldtoken owningtype // In order to call the right Expression APIs. - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void MultipleReferencesToTheSameProperty< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods, TUnknown>() @@ -1037,8 +1037,8 @@ static void MultipleReferencesToTheSameProperty< // ldtoken method (getter) // ldtoken owningtype // In order to call the right Expression APIs. - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] + [ExpectedWarning("IL2091", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/95121")] static void TwoMismatchesInOneStatement< [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] TPublicFields, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TPublicMethods> diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs index d15e18f44662b0..90a2caa130f706 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs @@ -267,7 +267,7 @@ public static void TestBranchMergeCatch() nameof(LocalDataFlow) + "." + nameof(GetWithPublicFields) + "()")] // ILLink produces extraneous warnings [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields) + "(String)", - nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "")] + nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchMergeFinally() { string str = GetWithPublicMethods(); @@ -288,7 +288,7 @@ public static void TestBranchMergeFinally() } // Analyzer gets this right (no warning), but trimmer merges all branches going forward. - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields) + "(String)", Tool.Trimmer, "")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchGoto() { string str = GetWithPublicMethods(); @@ -301,7 +301,7 @@ public static void TestBranchGoto() } // Analyzer gets this right (no warning), but trimmer merges all branches going forward. - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), Tool.Trimmer, "")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchIf() { string str = GetWithPublicMethods(); @@ -313,7 +313,7 @@ public static void TestBranchIf() } // Analyzer gets this right (no warning), but trimmer merges all branches going forward. - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), Tool.Trimmer, "")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchIfElse() { string str; @@ -332,12 +332,12 @@ public static void TestBranchIfElse() } // Analyzer gets this right (no warning), but trimmer merges all branches going forward. - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresNonPublicMethods) + "(String)", Tool.Trimmer, "")] - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicMethods) + "(String)", Tool.Trimmer, "")] - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicMethods) + "(String)", Tool.Trimmer, "")] - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", Tool.Trimmer, "")] - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", Tool.Trimmer, "")] - [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", Tool.Trimmer, "")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresNonPublicMethods) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicMethods) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicMethods) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] + [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchSwitch() { string str = null; @@ -364,7 +364,7 @@ public static void TestBranchSwitch() // Analyzer gets this right (no warning), but trimmer merges all branches going forward. [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), - nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "")] + nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchTry() { string str = GetWithPublicMethods(); @@ -383,7 +383,7 @@ public static void TestBranchTry() // Analyzer gets this right (no warning), but trimmer merges all branches going forward. [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), - nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "")] + nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchCatch() { string str = GetWithPublicMethods(); @@ -401,7 +401,7 @@ public static void TestBranchCatch() // Analyzer gets this right (no warning), but trimmer merges all branches going forward. [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicFields), - nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "")] + nameof(LocalDataFlow) + "." + nameof(GetWithPublicMethods) + "()", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/119110")] public static void TestBranchFinally() { string str = GetWithPublicMethods(); @@ -422,7 +422,7 @@ public static void TestBranchFinally() // Analyzer gets this right, but ILLink doesn't consider backwards branches. [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicMethods) + "(String)", - nameof(LocalDataFlow) + "." + nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + nameof(LocalDataFlow) + "." + nameof(GetWithPublicFields) + "()", Tool.Analyzer, "Analyzer limitation in extension method analysis")] public static void TestBackwardsEdgeLoop() { string str = GetWithPublicMethods(); @@ -439,7 +439,7 @@ public static void TestBackwardsEdgeLoop() // Analyzer gets this right, but ILLink doesn't consider backwards branches. [ExpectedWarning("IL2072", nameof(DataFlowStringExtensions) + "." + nameof(DataFlowStringExtensions.RequiresPublicMethods) + "(String)", - nameof(LocalDataFlow) + "." + nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + nameof(LocalDataFlow) + "." + nameof(GetWithPublicFields) + "()", Tool.Analyzer, "Analyzer limitation in extension method analysis")] public static void TestBackwardsEdgeGoto() { string str = null; diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs index 095127d5a194c1..e6ae495fe584a9 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs @@ -265,7 +265,7 @@ static void TestPassingRefProperty_OutParameter() TryGetAnnotatedValueOut(out TypeWithMethodsProperty); } - [ExpectedWarning("IL2072", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestPassingRefProperty_Mismatch() { TryGetAnnotatedValue(ref TypeWithFieldsProperty); @@ -312,8 +312,8 @@ static void TestPassingRefIndexer_OutParameter() } // https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2068", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2068", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] + [ExpectedWarning("IL2072", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestPassingRefIndexer_Mismatch() { var indexer = new RefIndexer_PublicFields(); @@ -321,7 +321,7 @@ static void TestPassingRefIndexer_Mismatch() } // https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2068", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2068", nameof(TryGetAnnotatedValue), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestPassingRefIndexer_OutParameter_Mismatch() { var indexer = new RefIndexer_PublicFields(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefReturnDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefReturnDataFlow.cs index bb9c2bb589d57e..b62b5a4c3f8735 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefReturnDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefReturnDataFlow.cs @@ -43,7 +43,7 @@ public static void Main() // Correct behavior in the trimming tools, but needs to be added in analyzer // Bug link: https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignToAnnotatedTypeReference() { ref Type typeShouldHaveAllMethods = ref ReturnAnnotatedTypeReferenceAsAnnotated(); @@ -53,7 +53,7 @@ static void AssignToAnnotatedTypeReference() // Same as above for IL analysis, but this looks different to the Roslyn analyzer. // https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignDirectlyToAnnotatedTypeReference() { ReturnAnnotatedTypeReferenceAsAnnotated() = typeof(TestTypeWithRequires); @@ -61,7 +61,7 @@ static void AssignDirectlyToAnnotatedTypeReference() } // https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2073", nameof(GetWithPublicFields), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2073", nameof(GetWithPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignToCapturedAnnotatedTypeReference() { // In this testcase, the Roslyn analyzer sees an assignment to a flow-capture reference. @@ -69,7 +69,7 @@ static void AssignToCapturedAnnotatedTypeReference() } [ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(ReturnAnnotatedTypeWithRequirements))] - [ExpectedWarning("IL2073", nameof(ReturnAnnotatedTypeWithRequirements), nameof(GetWithPublicFields), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2073", nameof(ReturnAnnotatedTypeWithRequirements), nameof(GetWithPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignToAnnotatedTypeReferenceWithRequirements() { ReturnAnnotatedTypeWithRequirements(GetWithPublicMethods()) = GetWithPublicFields(); @@ -80,7 +80,7 @@ static void AssignToAnnotatedTypeReferenceWithRequirements() [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] static ref Type AnnotatedTypeReferenceAsAnnotatedProperty => ref _annotatedField; - [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignToAnnotatedTypeReferenceProperty() { ref Type typeShouldHaveAllMethods = ref AnnotatedTypeReferenceAsAnnotatedProperty; @@ -89,7 +89,7 @@ static void AssignToAnnotatedTypeReferenceProperty() } // https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "Message for --TestType.Requires--", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignDirectlyToAnnotatedTypeReferenceProperty() { AnnotatedTypeReferenceAsAnnotatedProperty = typeof(TestTypeWithRequires); @@ -97,7 +97,7 @@ static void AssignDirectlyToAnnotatedTypeReferenceProperty() } // https://github.com/dotnet/linker/issues/2158 - [ExpectedWarning("IL2073", nameof(GetWithPublicFields), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2073", nameof(GetWithPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignToCapturedAnnotatedTypeReferenceProperty() { AnnotatedTypeReferenceAsAnnotatedProperty = GetWithPublicMethods() ?? GetWithPublicFields(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs index 5ecc18734a1f5c..ba609adaf80f1d 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs @@ -231,7 +231,7 @@ static Type PropertyWithSimpleGetter // is highly unlikely to be done by anybody. If it happens, the analyzer will produce warnings which the trimming tools will not // but those warnings are not really wrong, so it's better if the developer fixes them anyway. [ExpectedWarning("IL2077", nameof(DataFlowTypeExtensions) + "." + nameof(DataFlowTypeExtensions.RequiresPublicConstructors) + "(Type)", - nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWhichLooksLikeCompilerGenerated_Field), Tool.Analyzer, "")] + nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWhichLooksLikeCompilerGenerated_Field), Tool.Analyzer, "Analyzer does not recognize compiler-generated backing fields")] public void TestPropertyWhichLooksLikeCompilerGenerated() { // If the property was correctly recognized both the property getter and the backing field should get the annotation. @@ -247,7 +247,7 @@ static Type PropertyWhichLooksLikeCompilerGenerated { // See above comment about fake compiler generated backing fields - this warning is expected from the analyzer [ExpectedWarning("IL2078", nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWhichLooksLikeCompilerGenerated) + ".get", - nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWhichLooksLikeCompilerGenerated_Field), Tool.Analyzer, "")] + nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWhichLooksLikeCompilerGenerated_Field), Tool.Analyzer, "Analyzer does not recognize compiler-generated backing fields")] [CompilerGenerated] get { @@ -292,12 +292,12 @@ public void TestPropertyWithDifferentBackingFields() // Analyzer doesn't try to detect backing fields of properties: https://github.com/dotnet/linker/issues/2273 [ExpectedWarning("IL2078", nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWithDifferentBackingFields) + ".get", - "Type", Tool.Analyzer, "")] + "Type", Tool.Analyzer, "Analyzer limitation in property dataflow analysis")] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type PropertyWithDifferentBackingFields { [ExpectedWarning("IL2078", - nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWithDifferentBackingFields) + ".get", Tool.Trimmer | Tool.NativeAot, "")] + nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWithDifferentBackingFields) + ".get", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT limitation in property dataflow analysis")] [CompilerGenerated] get { @@ -324,42 +324,42 @@ public void TestPropertyWithExistingAttributes() [CompilerGenerated] Type PropertyWithExistingMatchingAttributes_Field; - [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.get"], Tool.Analyzer, "")] - [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.set"], Tool.Analyzer, "")] + [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.get"], Tool.Analyzer, "Analyzer limitation in property accessor tracking")] + [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.set"], Tool.Analyzer, "Analyzer limitation in property accessor tracking")] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type PropertyWithExistingMatchingAttributes { - [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.get"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.get"], Tool.Trimmer | Tool.NativeAot, "Property accessor tracking difference")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] [CompilerGenerated] get { return PropertyWithExistingMatchingAttributes_Field; } - [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.set"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2043", ["PropertyWithExistingMatchingAttributes", "PropertyWithExistingMatchingAttributes.set"], Tool.Trimmer | Tool.NativeAot, "Property accessor tracking difference")] [param: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] [CompilerGenerated] set { PropertyWithExistingMatchingAttributes_Field = value; } } // Analyzer doesn't try to detect backing fields of properties: https://github.com/dotnet/linker/issues/2273 - [ExpectedWarning("IL2056", "PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes_Field", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2056", "PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes_Field", Tool.Trimmer | Tool.NativeAot, "Property tracking difference")] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] [CompilerGenerated] Type PropertyWithExistingMismatchedAttributes_Field; - [ExpectedWarning("IL2043", ["PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.get"], Tool.Analyzer, "")] - [ExpectedWarning("IL2043", ["PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.set"], Tool.Analyzer, "")] + [ExpectedWarning("IL2043", ["PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.get"], Tool.Analyzer, "Analyzer limitation in property accessor tracking")] + [ExpectedWarning("IL2043", ["PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.set"], Tool.Analyzer, "Analyzer limitation in property accessor tracking")] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type PropertyWithExistingMismatchedAttributes { // On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654 - [ExpectedWarning("IL2043", "PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.get", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2043", "PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.get", Tool.Trimmer | Tool.NativeAot, "Property accessor tracking difference")] [ExpectedWarning("IL2078", "return value", "PropertyWithExistingMismatchedAttributes_Field")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] [CompilerGenerated] get { return PropertyWithExistingMismatchedAttributes_Field; } // On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654 - [ExpectedWarning("IL2043", "PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.set", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2043", "PropertyWithExistingMismatchedAttributes", "PropertyWithExistingMismatchedAttributes.set", Tool.Trimmer | Tool.NativeAot, "Property accessor tracking difference")] [ExpectedWarning("IL2069", "PropertyWithExistingMismatchedAttributes_Field", "parameter 'value'")] [param: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] [CompilerGenerated] @@ -381,24 +381,24 @@ public void TestPropertyWithConflictingAttributes() } // Analyzer doesn't try to detect backing fields of properties: https://github.com/dotnet/linker/issues/2273 - [ExpectedWarning("IL2056", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes_Field", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2056", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes_Field", Tool.Trimmer | Tool.NativeAot, "Property tracking difference")] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors)] [CompilerGenerated] Type PropertyWithConflictingAttributes_Field; - [ExpectedWarning("IL2043", ["PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.get"], Tool.Analyzer, "")] - [ExpectedWarning("IL2043", ["PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.set"], Tool.Analyzer, "")] + [ExpectedWarning("IL2043", ["PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.get"], Tool.Analyzer, "Analyzer limitation in property accessor tracking")] + [ExpectedWarning("IL2043", ["PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.set"], Tool.Analyzer, "Analyzer limitation in property accessor tracking")] [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type PropertyWithConflictingAttributes { // On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654 - [ExpectedWarning("IL2043", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.get", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2043", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.get", Tool.Trimmer | Tool.NativeAot, "Property accessor tracking difference")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors)] [CompilerGenerated] get { return PropertyWithConflictingAttributes_Field; } // On property/accessor mismatch, ILLink warns on accessor and analyzer warns on property https://github.com/dotnet/linker/issues/2654 - [ExpectedWarning("IL2043", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.set", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2043", "PropertyWithConflictingAttributes", "PropertyWithConflictingAttributes.set", Tool.Trimmer | Tool.NativeAot, "Property accessor tracking difference")] [param: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors)] [CompilerGenerated] set { PropertyWithConflictingAttributes_Field = value; } @@ -427,7 +427,7 @@ Type PropertyWithConflictingNoneAttributes { // See above comment about fake compiler generated backing fields - this warning is expected from analyzer [ExpectedWarning("IL2078", nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWithConflictingNoneAttributes) + ".get", - nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWithConflictingNoneAttributes_Field), Tool.Analyzer, "")] + nameof(TestAutomaticPropagationType) + "." + nameof(PropertyWithConflictingNoneAttributes_Field), Tool.Analyzer, "Analyzer limitation in property dataflow analysis")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.None)] [CompilerGenerated] get { return PropertyWithConflictingNoneAttributes_Field; } @@ -445,8 +445,8 @@ public void TestPropertyWithIndexerWithMatchingAnnotations([DynamicallyAccessedM } // Trimmer and analyzer handle formatting of indexers differently. - [ExpectedWarning("IL2067", nameof(PropertyWithIndexer) + ".Item.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2067", nameof(PropertyWithIndexer) + ".this[Int32].set", Tool.Analyzer, "")] + [ExpectedWarning("IL2067", nameof(PropertyWithIndexer) + ".Item.set", Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] + [ExpectedWarning("IL2067", nameof(PropertyWithIndexer) + ".this[Int32].set", Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] [ExpectedWarning("IL2072", nameof(DataFlowTypeExtensions) + "." + nameof(DataFlowTypeExtensions.RequiresNonPublicConstructors) + "(Type)")] [LogDoesNotContain("'Value passed to parameter 'index' of method 'Mono.Linker.Tests.Cases.DataFlow.PropertyDataFlow.TestAutomaticPropagationType.PropertyWithIndexer.Item.set'")] public void TestPropertyWithIndexerWithoutMatchingAnnotations(Type myType) @@ -465,8 +465,8 @@ public class PropertyWithIndexer public Type this[int index] { // Trimmer and analyzer handle formatting of indexers differently. - [ExpectedWarning("IL2063", nameof(PropertyWithIndexer) + ".Item.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2063", nameof(PropertyWithIndexer) + ".this[Int32].get", Tool.Analyzer, "")] + [ExpectedWarning("IL2063", nameof(PropertyWithIndexer) + ".Item.get", Tool.Trimmer | Tool.NativeAot, "Indexer annotation tracking difference")] + [ExpectedWarning("IL2063", nameof(PropertyWithIndexer) + ".this[Int32].get", Tool.Analyzer, "Analyzer limitation in indexer tracking")] get => Property_Field[index]; set => Property_Field[index] = value; } @@ -719,15 +719,15 @@ Type this[Index idx] set => throw new NotImplementedException(); } - [ExpectedWarning("IL2072", ["this[Index].get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", ["Item.get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", ["this[Index].get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", ["Item.get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestRead(ExplicitIndexerAccess instance = null) { instance[new Index(1)].RequiresAll(); } - [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "this[Index].set"], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "Item.set"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "this[Index].set"], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "Item.set"], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestWrite(ExplicitIndexerAccess instance = null) { instance[^1] = GetTypeWithPublicConstructors(); @@ -751,22 +751,22 @@ Type this[int idx] int Length => throw new NotImplementedException(); - [ExpectedWarning("IL2072", ["this[Int32].get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", ["Item.get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", ["this[Int32].get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", ["Item.get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestRead(ImplicitIndexerAccess instance = null) { instance[new Index(1)].RequiresAll(); } - [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "this[Int32].set"], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "Item.set"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "this[Int32].set"], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "Item.set"], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestWrite(ImplicitIndexerAccess instance = null) { instance[^1] = GetTypeWithPublicConstructors(); } - [ExpectedWarning("IL2072", [nameof(GetUnknownType), "this[Int32].set"], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", [nameof(GetUnknownType), "Item.set"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", [nameof(GetUnknownType), "this[Int32].set"], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", [nameof(GetUnknownType), "Item.set"], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestNullCoalescingAssignment(ImplicitIndexerAccess instance = null) { instance[new Index(1)] ??= GetUnknownType(); @@ -791,8 +791,8 @@ int this[[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields get => throw new NotImplementedException(); } - [ExpectedWarning("IL2067", ["this[Type].get", nameof(ParamDoesNotMeetRequirements)], Tool.Analyzer, "")] - [ExpectedWarning("IL2067", ["Item.get", nameof(ParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2067", ["this[Type].get", nameof(ParamDoesNotMeetRequirements)], Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] + [ExpectedWarning("IL2067", ["Item.get", nameof(ParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] static void ParamDoesNotMeetRequirements(Type t) { var x = new IndexWithTypeWithDam(); @@ -805,8 +805,8 @@ static void ParamDoesMeetRequirements([DynamicallyAccessedMembers(DynamicallyAcc _ = x[t]; } - [ExpectedWarning("IL2087", ["this[Type].get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Analyzer, "")] - [ExpectedWarning("IL2087", ["Item.get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2087", ["this[Type].get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Analyzer, "Analyzer limitation in generic parameter tracking")] + [ExpectedWarning("IL2087", ["Item.get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "Analyzer limitation in generic parameter tracking")] static void TypeParamDoesNotMeetRequirements() { var x = new IndexWithTypeWithDam(); @@ -847,8 +847,8 @@ Type this[[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicField [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] static Type fieldWithMethods; - [ExpectedWarning("IL2067", ["this[Type].get", nameof(ParamDoesNotMeetRequirements)], Tool.Analyzer, "")] - [ExpectedWarning("IL2067", ["Item.get", nameof(ParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2067", ["this[Type].get", nameof(ParamDoesNotMeetRequirements)], Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] + [ExpectedWarning("IL2067", ["Item.get", nameof(ParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] static void ParamDoesNotMeetRequirements(Type t) { var x = new IndexWithTypeWithDam(); @@ -861,8 +861,8 @@ static void ParamDoesMeetRequirements([DynamicallyAccessedMembers(DynamicallyAcc fieldWithMethods = x[t]; } - [ExpectedWarning("IL2087", ["this[Type].get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Analyzer, "")] - [ExpectedWarning("IL2087", ["Item.get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2087", ["this[Type].get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Analyzer, "Analyzer limitation in generic parameter tracking")] + [ExpectedWarning("IL2087", ["Item.get", nameof(TypeParamDoesNotMeetRequirements)], Tool.Trimmer | Tool.NativeAot, "Analyzer limitation in generic parameter tracking")] static void TypeParamDoesNotMeetRequirements() { var x = new IndexWithTypeWithDam(); @@ -884,16 +884,16 @@ static void KnownTypeDoesMeetRequirements() fieldWithMethods = x[t]; } - [ExpectedWarning("IL2067", ["this[Type].set", nameof(t), "idx"], Tool.Analyzer, "")] - [ExpectedWarning("IL2067", ["Item.set", nameof(t), "idx"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2067", ["this[Type].set", nameof(t), "idx"], Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] + [ExpectedWarning("IL2067", ["Item.set", nameof(t), "idx"], Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] static void ValueMeetsRequirementsIndexDoesNot(Type t) { var x = new IndexWithTypeWithDam(); x[t] = fieldWithMethods; } - [ExpectedWarning("IL2067", ["this[Type].set", nameof(tUnannotated), "value"], Tool.Analyzer, "")] - [ExpectedWarning("IL2067", ["Item.set", nameof(tUnannotated), "value"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2067", ["this[Type].set", nameof(tUnannotated), "value"], Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] + [ExpectedWarning("IL2067", ["Item.set", nameof(tUnannotated), "value"], Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] static void ValueDoesNotMeetRequirementsIndexDoes([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] Type t, Type tUnannotated) { var x = new IndexWithTypeWithDam(); @@ -938,16 +938,16 @@ public Type this[[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Publ index.RequiresPublicConstructors(); return null; } - [ExpectedWarning("IL2067", ["this[Type].set", "index"], Tool.Analyzer, "")] - [ExpectedWarning("IL2067", ["Item.set", "index"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2067", ["this[Type].set", "index"], Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] + [ExpectedWarning("IL2067", ["Item.set", "index"], Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] set { index.RequiresPublicMethods(); } } - [ExpectedWarning("IL2067", ["this[Type].set", nameof(unannotated), "index"], Tool.Analyzer, "")] - [ExpectedWarning("IL2067", ["Item.set", nameof(unannotated), "index"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2067", ["this[Type].set", nameof(unannotated), "index"], Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] + [ExpectedWarning("IL2067", ["Item.set", nameof(unannotated), "index"], Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] static void ParameterMismatch(Type unannotated = null) { var instance = new AnnotatedIndexerParameter(); @@ -976,15 +976,15 @@ class IndexerDefaultArgument set => throw new NotImplementedException(); } - [ExpectedWarning("IL2072", ["this[Int32].get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", ["Item.get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", ["this[Int32].get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", ["Item.get", nameof(DataFlowTypeExtensions.RequiresAll)], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestRead(IndexerDefaultArgument instance = null) { instance[1].RequiresAll(); } - [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "this[Int32].set"], Tool.Analyzer, "")] - [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "Item.set"], Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "this[Int32].set"], Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2072", [nameof(GetTypeWithPublicConstructors), "Item.set"], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void TestWrite(IndexerDefaultArgument instance = null) { instance[1] = GetTypeWithPublicConstructors(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/RefFieldDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/RefFieldDataFlow.cs index 9fbb100974b508..4dde44f08bdbf1 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/RefFieldDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/RefFieldDataFlow.cs @@ -91,11 +91,11 @@ static void AssignRefToLocals< tmf = typeof(TF); // This is a hole that doesn't warn but assigns a misannotated value to target.T } - [ExpectedWarning("IL2089", "RefFieldWithMethods", "T", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2089", "RefFieldWithFields", "T", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2089", "RefFieldWithMethodsAndFields", "T", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2089", "RefFieldWithMethodsAndFields", "T", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2089", "RefFieldWithFields", "T", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2089", "RefFieldWithMethods", "T", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] + [ExpectedWarning("IL2089", "RefFieldWithFields", "T", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] + [ExpectedWarning("IL2089", "RefFieldWithMethodsAndFields", "T", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] + [ExpectedWarning("IL2089", "RefFieldWithMethodsAndFields", "T", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] + [ExpectedWarning("IL2089", "RefFieldWithFields", "T", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/101734")] static void AssignRefLocals< T, [DAM(DAMT.PublicMethods)] TM, diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs index c83ea66323dd2e..6165f27d16629b 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/TypeBaseTypeDataFlow.cs @@ -404,7 +404,7 @@ static void EnumerateInterfacesOnBaseTypes([DynamicallyAccessedMembers(Dynamical } [ExpectedWarning("IL2070")] - [ExpectedWarning("IL2075", Tool.Analyzer, "")] // ILLink doesn't implement backward branches data flow yet + [ExpectedWarning("IL2075", Tool.Analyzer, "Analyzer limitation in dataflow analysis")] // ILLink doesn't implement backward branches data flow yet static void EnumerateInterfacesOnBaseTypes_Unannotated(Type type) { Type? t = type; diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs index 5a6e995a483bd4..f77c578fbf7d4b 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs @@ -45,8 +45,8 @@ static void MethodWithUnresolvedGenericArgument< { } [Kept] - [ExpectedWarning("IL2066", "TypeWithUnresolvedGenericArgument", Tool.Trimmer | Tool.Analyzer, "")] // Called method declaring type - [ExpectedWarning("IL2066", nameof(MethodWithUnresolvedGenericArgument), Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2066", "TypeWithUnresolvedGenericArgument", Tool.Trimmer | Tool.Analyzer, "Unresolved member pattern")] // Called method declaring type + [ExpectedWarning("IL2066", nameof(MethodWithUnresolvedGenericArgument), Tool.Trimmer | Tool.Analyzer, "Unresolved member pattern")] static void UnresolvedGenericArgument() { var a = new TypeWithUnresolvedGenericArgument(); @@ -76,7 +76,7 @@ public AttributeWithRequirements( } [Kept] - [ExpectedWarning("IL2062", nameof(AttributeWithRequirements), Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2062", nameof(AttributeWithRequirements), Tool.Trimmer | Tool.Analyzer, "Unresolved member pattern")] [KeptAttributeAttribute(typeof(AttributeWithRequirements))] [AttributeWithRequirements(typeof(Dependencies.UnresolvedType))] static void UnresolvedAttributeArgument() @@ -84,7 +84,7 @@ static void UnresolvedAttributeArgument() } [Kept] - [ExpectedWarning("IL2062", nameof(AttributeWithRequirements.PropertyWithRequirements), Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2062", nameof(AttributeWithRequirements.PropertyWithRequirements), Tool.Trimmer | Tool.Analyzer, "Unresolved member pattern")] [KeptAttributeAttribute(typeof(AttributeWithRequirements))] [AttributeWithRequirements(typeof(EmptyType), PropertyWithRequirements = typeof(Dependencies.UnresolvedType))] static void UnresolvedAttributePropertyValue() @@ -92,7 +92,7 @@ static void UnresolvedAttributePropertyValue() } [Kept] - [ExpectedWarning("IL2064", nameof(AttributeWithRequirements.FieldWithRequirements), Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2064", nameof(AttributeWithRequirements.FieldWithRequirements), Tool.Trimmer | Tool.Analyzer, "Unresolved member pattern")] [KeptAttributeAttribute(typeof(AttributeWithRequirements))] [AttributeWithRequirements(typeof(EmptyType), FieldWithRequirements = typeof(Dependencies.UnresolvedType))] static void UnresolvedAttributeFieldValue() @@ -103,14 +103,14 @@ static void UnresolvedAttributeFieldValue() static Dependencies.UnresolvedType _unresolvedField; [Kept] - [ExpectedWarning("IL2072", nameof(Object.GetType), Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(Object.GetType), Tool.Trimmer | Tool.Analyzer, "Analyzer behavior for GetType")] static void UnresolvedObjectGetType() { RequirePublicMethods(_unresolvedField.GetType()); } [Kept] - [ExpectedWarning("IL2072", nameof(Object.GetType), Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(Object.GetType), Tool.Trimmer | Tool.Analyzer, "Analyzer behavior for GetType")] static void UnresolvedMethodParameter() { RequirePublicMethods(typeof(Dependencies.UnresolvedType)); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs index 5e43a8ad5c0997..0c69a53414116f 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/VirtualMethodHierarchyDataflowAnnotationValidation.cs @@ -639,24 +639,24 @@ class ImplIDamOnAllMissing : IDamOnAll // NativeAOT doesn't validate overrides when accessed through reflection because it's a direct call (non-virtual) // So it doesn't matter that the annotations are not in-sync since the access will validate // the annotations on the implementation method - it doesn't even see the base method in this case. - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] public static Type AbstractMethod(Type type) => null; // NativeAOT doesn't validate overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] public static Type VirtualMethod(Type type) => null; } class ImplIDamOnAllMismatch : IDamOnAll { // NativeAOT doesn't validate overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] public static Type AbstractMethod <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] @@ -666,9 +666,9 @@ public static Type AbstractMethod { return null; } // NativeAOT doesn't validate overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] public static Type VirtualMethod <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] @@ -712,9 +712,9 @@ class ImplIDamOnNoneMatch : IDamOnNone class ImplIDamOnNoneMismatch : IDamOnNone { // NativeAOT doesn't validate overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] public static Type AbstractMethod <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] @@ -724,9 +724,9 @@ public static Type AbstractMethod { return null; } // NativeAOT doesn't validate overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] public static Type VirtualMethod <[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] @@ -755,7 +755,7 @@ class BaseInPreservedScope class ImplIAnnotatedMethodsMismatch : Library.IAnnotatedMethods { // NativeAOT doesn't always validate static overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] public static void GenericWithMethodsStatic() { } [ExpectedWarning("IL2092")] @@ -777,7 +777,7 @@ public void ParamWithMethods(Type t) { } class ImplIUnannotatedMethodsMismatch : Library.IUnannotatedMethods { // NativeAOT doesn't always validate static overrides when accessed through reflection because it's a direct call (non-virtual) - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] public static void GenericStatic<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>() { } [ExpectedWarning("IL2092")] @@ -975,9 +975,9 @@ interface IGvmBase class ImplIGvmBase : IGvmBase { // NativeAOT doesn't validate overrides when it can resolve them as direct calls - [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "")] - [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "")] + [ExpectedWarning("IL2092", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2093", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] + [ExpectedWarning("IL2095", Tool.Trimmer | Tool.Analyzer, "Analyzer follows different virtual method hierarchy validation rules")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] public Type UnannotatedGvm<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => null; diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Extensibility/CustomWarningUsage.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Extensibility/CustomWarningUsage.cs index f7af58179c5174..4a2b902a3d49d1 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Extensibility/CustomWarningUsage.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Extensibility/CustomWarningUsage.cs @@ -10,7 +10,7 @@ namespace Mono.Linker.Tests.Cases.Extensibility [ExpectedNoWarnings] public class CustomWarningUsage { - [ExpectedWarning("IL2026", "--RUCMethod--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--RUCMethod--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] public static void Main() { new KnownTypeThatShouldWarn(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/LinkXmlErrorCases.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/LinkXmlErrorCases.cs index 68fa608cc831de..b7ff612333bfd9 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/LinkXmlErrorCases.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/LinkXmlErrorCases.cs @@ -29,7 +29,7 @@ namespace Mono.Linker.Tests.Cases.LinkXml [LogContains("Duplicate preserve of 'Mono.Linker.Tests.Cases.LinkXml.LinkXmlErrorCases.TypeWithEverything.Property.set'", ProducedBy = Tool.Trimmer)] // NativeAOT doesn't support wildcard * and will skip usages of it, including if they would warn // https://github.com/dotnet/runtime/issues/80466 - [ExpectedWarning("IL2100", Tool.Trimmer, "", FileName = "LinkXmlErrorCases.xml", SourceLine = 50, SourceColumn = 4)] + [ExpectedWarning("IL2100", Tool.Trimmer, "Trimmer-specific XML processing", FileName = "LinkXmlErrorCases.xml", SourceLine = 50, SourceColumn = 4)] class LinkXmlErrorCases { public static void Main() diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Logging/SourceLines.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Logging/SourceLines.cs index 8198da201766ec..b64ab116f55f08 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Logging/SourceLines.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Logging/SourceLines.cs @@ -31,16 +31,16 @@ static Type GetUnknownType() // Analyzer test infrastructure doesn't support ExpectedWarning at the top-level. // This is OK because the test is meant to validate that the ILLink infrastructure produces the right line numbers, // and we have separate tests to check the line number of analyzer warnings. - [ExpectedWarning("IL2074", nameof(SourceLines) + "." + nameof(type), nameof(SourceLines) + "." + nameof(GetUnknownType) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2074", nameof(SourceLines) + "." + nameof(type), nameof(SourceLines) + "." + nameof(GetUnknownType) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2074", nameof(SourceLines) + "." + nameof(type), nameof(SourceLines) + "." + nameof(GetUnknownType) + "()", Tool.Analyzer, "Analyzer limitation in dataflow analysis")] + [ExpectedWarning("IL2074", nameof(SourceLines) + "." + nameof(type), nameof(SourceLines) + "." + nameof(GetUnknownType) + "()", Tool.Analyzer, "Analyzer limitation in dataflow analysis")] static void UnrecognizedReflectionPattern() { type = GetUnknownType(); // IL2074 type = GetUnknownType(); // IL2074 } - [ExpectedWarning("IL2091", "LocalFunction()", Tool.Analyzer, "")] - [ExpectedWarning("IL2089", nameof(SourceLines) + "." + nameof(type), "TOuterMethod", Tool.Analyzer, "")] + [ExpectedWarning("IL2091", "LocalFunction()", Tool.Analyzer, "Analyzer limitation in local function tracking")] + [ExpectedWarning("IL2089", nameof(SourceLines) + "." + nameof(type), "TOuterMethod", Tool.Analyzer, "Analyzer limitation in generic parameter tracking")] static IEnumerable GenericMethodIteratorWithRequirement<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] TOuterMethod>() { LocalFunction(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs index 8cd6abcd436d19..68dfbcf3de88ac 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs @@ -171,8 +171,8 @@ public FromParameterOnStaticMethodTypeB(int arg) { } } // Small formatting difference - [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, Object[])", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, params Object[])", Tool.Analyzer, "")] + [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, Object[])", Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] + [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, params Object[])", Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance), nameof(CultureInfo))] [Kept] private void FromParameterOnInstanceMethod( @@ -197,8 +197,8 @@ public FromParameterOnInstanceMethodType(int arg, int arg2) { } [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type)")] // Small formatting difference - [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, Object[])", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, params Object[])", Tool.Analyzer, "")] + [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, Object[])", Tool.Trimmer | Tool.NativeAot, "Parameter annotation tracking difference")] + [ExpectedWarning("IL2067", nameof(Activator) + "." + nameof(Activator.CreateInstance) + "(Type, params Object[])", Tool.Analyzer, "Analyzer limitation in parameter annotation tracking")] [Kept] private static void FromParameterWithNonPublicConstructors( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors)] @@ -375,7 +375,7 @@ private static void WithAssemblyAndNoValueTypeName() [Kept] // Analyzer doesn't handle assembly resolution - [ExpectedWarning("IL2061", nameof(Activator) + "." + nameof(Activator.CreateInstance), "NonExistingAssembly", Tool.Trimmer, "")] + [ExpectedWarning("IL2061", nameof(Activator) + "." + nameof(Activator.CreateInstance), "NonExistingAssembly", Tool.Trimmer, "Trimmer specific assembly resolution warning")] private static void WithNonExistingAssemblyName() { Activator.CreateInstance("NonExistingAssembly", "Mono.Linker.Tests.Cases.Reflection.ActivatorCreateInstance+WithAssemblyNameParameterless1"); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs index f666cadeb650f5..ded799f0dc5b5f 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/TypeUsedViaReflection.cs @@ -452,9 +452,9 @@ public class OverloadWith5ParametersWithIgnoreCase { } [Kept] // Small difference in formatting between analyzer/NativeAOT/linker - [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Trimmer, "")] - [ExpectedWarning("IL2096", "'System.Type.GetType(String,Func`2,Func`4,Boolean,Boolean)'", Tool.NativeAot, "")] - [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Analyzer, "")] + [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Trimmer, "Different formatting of generic parameters between tools")] + [ExpectedWarning("IL2096", "'System.Type.GetType(String,Func`2,Func`4,Boolean,Boolean)'", Tool.NativeAot, "Different formatting of generic parameters between tools")] + [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Analyzer, "Different formatting of generic parameters between tools")] static void TestTypeOverloadWith5ParametersWithIgnoreCase() { const string reflectionTypeKeptString = "Mono.Linker.Tests.Cases.Reflection.TypeUsedViaReflection+OverloadWith5ParametersWithIgnoreCase"; @@ -511,9 +511,9 @@ static void TestUnknownIgnoreCase3Params(int num) [Kept] // Small difference in formatting between analyzer/NativeAOT/linker - [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Trimmer, "")] - [ExpectedWarning("IL2096", "'System.Type.GetType(String,Func`2,Func`4,Boolean,Boolean)'", Tool.NativeAot, "")] - [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Analyzer, "")] + [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Trimmer, "Different formatting of generic parameters between tools")] + [ExpectedWarning("IL2096", "'System.Type.GetType(String,Func`2,Func`4,Boolean,Boolean)'", Tool.NativeAot, "Different formatting of generic parameters between tools")] + [ExpectedWarning("IL2096", "'System.Type.GetType(String, Func, Func, Boolean, Boolean)'", Tool.Analyzer, "Different formatting of generic parameters between tools")] static void TestUnknownIgnoreCase5Params(int num) { const string reflectionTypeKeptString = "mono.linker.tests.cases.reflection.TypeUsedViaReflection+CaseUnknown2, test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"; diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/BasicRequires.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/BasicRequires.cs index db3e16cdc6ce79..a2779edabe4018 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/BasicRequires.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/BasicRequires.cs @@ -247,7 +247,7 @@ static void TestEvent() EventRequires(null, null); // no warning on invocation } - [ExpectedWarning("IL3002", "--Requires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--Requires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] public static void Test() { Requires(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAccessedThrough.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAccessedThrough.cs index 7e955727d3addf..bc6bd9aa4f72f3 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAccessedThrough.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAccessedThrough.cs @@ -60,8 +60,8 @@ public static void RequiresOnlyThroughReflection() } [ExpectedWarning("IL2026", "--GenericType.RequiresOnlyThroughReflection--")] - [ExpectedWarning("IL3002", "--GenericType.RequiresOnlyThroughReflection--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--GenericType.RequiresOnlyThroughReflection--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--GenericType.RequiresOnlyThroughReflection--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--GenericType.RequiresOnlyThroughReflection--", Tool.NativeAot, "NativeAOT specific warning")] public static void Test() { typeof(AccessedThroughReflectionOnGenericType) @@ -105,7 +105,7 @@ public PInvokeReturnType() { } static extern PInvokeReturnType PInvokeReturnsType(); // Analyzer doesn't support IL2050 yet - [ExpectedWarning("IL2050", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2050", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] public static void Test() { PInvokeReturnsType(); @@ -222,11 +222,11 @@ static bool PropertyWithLdToken } [ExpectedWarning("IL2026", "--PropertyWithLdToken.get--")] - [ExpectedWarning("IL2026", "--PropertyWithLdToken.get--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--PropertyWithLdToken.get--", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] [ExpectedWarning("IL3002", "--PropertyWithLdToken.get--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] - [ExpectedWarning("IL3002", "--PropertyWithLdToken.get--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--PropertyWithLdToken.get--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL3050", "--PropertyWithLdToken.get--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] - [ExpectedWarning("IL3050", "--PropertyWithLdToken.get--", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "--PropertyWithLdToken.get--", Tool.NativeAot, "NativeAOT specific warning")] static void TestPropertyLdToken() { Expression> getter = () => PropertyWithLdToken; @@ -340,15 +340,15 @@ private Target(int i) { } private static void MethodRequires() { } } - [ExpectedWarning("IL2026", "--Target.MethodRequires--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--Target.MethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--Target.MethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--Target.MethodRequires--", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] + [ExpectedWarning("IL3002", "--Target.MethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--Target.MethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] [UnsafeAccessor(UnsafeAccessorKind.StaticMethod)] extern static void MethodRequires(Target target); - [ExpectedWarning("IL2026", "--Target..ctor--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--Target..ctor--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--Target..ctor--", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--Target..ctor--", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] + [ExpectedWarning("IL3002", "--Target..ctor--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--Target..ctor--", Tool.NativeAot, "NativeAOT specific warning")] [UnsafeAccessor(UnsafeAccessorKind.Constructor)] extern static Target Constructor(int i); @@ -366,22 +366,22 @@ private void InstanceMethod() { } private int InstanceField; } - [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] [UnsafeAccessor(UnsafeAccessorKind.Constructor)] extern static TargetWithRequires TargetRequiresConstructor(); - [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] [UnsafeAccessor(UnsafeAccessorKind.StaticMethod, Name = "StaticMethod")] extern static void TargetRequiresStaticMethod(TargetWithRequires target); // For trimmer this is a reflection access to an instance method - and as such it must warn (since it's in theory possible // to invoke the method via reflection on a null instance) // For NativeAOT this is a direct call to an instance method (there's no reflection involved) and as such it doesn't need to warn - [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer, "")] + [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer, "ldtoken pattern not tracked by Trimmer")] [UnsafeAccessor(UnsafeAccessorKind.Method, Name = "InstanceMethod")] extern static void TargetRequiresInstanceMethod(TargetWithRequires target); - [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--TargetWitRequires--", Tool.Trimmer | Tool.NativeAot, "ldtoken pattern not tracked by Trimmer/NativeAOT")] [UnsafeAccessor(UnsafeAccessorKind.StaticField, Name = "StaticField")] extern static ref int TargetRequiresStaticField(TargetWithRequires target); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAttributeMismatch.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAttributeMismatch.cs index 32ce9323112ec1..05624434283d7c 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAttributeMismatch.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresAttributeMismatch.cs @@ -26,87 +26,87 @@ class RequiresAttributeMismatch // The analyzer matches this behavior, treating the get/set methods as annotated if the property is annotated, // and warning only on the get/set methods. [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.set")] - [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInProperty.get")] - [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInProperty.set")] - [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInPropertyAndAccessor.set")] - [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualMethod()")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualMethod()")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualMethod()")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedClassWithRequires.VirtualMethod()")] - [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "DerivedClassWithRequires.VirtualMethod()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "DerivedClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "DerivedClassWithRequires.VirtualMethod()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "IBaseWithRequires.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set")] - [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "IBaseWithRequires.PropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "IBaseWithRequires.Method()")] - [ExpectedWarning("IL3002", "IBaseWithRequires.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "IBaseWithRequires.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "IBaseWithRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "IBaseWithRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationClassWithRequires.Method()")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequires.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ImplementationClassWithRequires.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "ImplementationClassWithRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequires.PropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3002", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationClassWithRequiresInSource.Method()")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ImplementationClassWithRequiresInSource.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "ImplementationClassWithRequiresInSource.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3002", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty.set", Tool.NativeAot, "NativeAOT specific warning")] public static void Main() { @@ -393,7 +393,7 @@ public string PropertyAnnotationInAccesor } [RequiresAssemblyFiles("Message")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] public string PropertyAnnotationInProperty { [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] @@ -403,7 +403,7 @@ public string PropertyAnnotationInProperty } [RequiresAssemblyFiles("Message")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] public string PropertyAnnotationInPropertyAndAccessor { [RequiresAssemblyFiles("Message")] @@ -422,12 +422,12 @@ class ExplicitImplementationClassWithRequires : IBaseWithoutRequires [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] // ILLink member string format includes namespace of explicit interface method. - [ExpectedWarning("IL2046", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL2046", "ExplicitImplementationClassWithRequires.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer, "")] - [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer, "")] - [ExpectedWarning("IL3051", "IBaseWithoutRequires.Method()", "ExplicitImplementationClassWithRequires.IBaseWithoutRequires.Method()", Tool.Analyzer, "")] + [ExpectedWarning("IL2046", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT warn on explicit interface implementation mismatch")] + [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3051", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2046", "ExplicitImplementationClassWithRequires.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] + [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.IBaseWithoutRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] + [ExpectedWarning("IL3051", "IBaseWithoutRequires.Method()", "ExplicitImplementationClassWithRequires.IBaseWithoutRequires.Method()", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] void IBaseWithoutRequires.Method() { } @@ -446,7 +446,7 @@ string IBaseWithoutRequires.PropertyAnnotationInAccesor } [RequiresAssemblyFiles("Message")] - [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] string IBaseWithoutRequires.PropertyAnnotationInProperty { [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] @@ -456,7 +456,7 @@ string IBaseWithoutRequires.PropertyAnnotationInProperty } [RequiresAssemblyFiles("Message")] - [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] string IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor { [RequiresAssemblyFiles("Message")] @@ -488,7 +488,7 @@ public string PropertyAnnotationInAccesor set { name = value; } } - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] public string PropertyAnnotationInProperty { [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] @@ -497,7 +497,7 @@ public string PropertyAnnotationInProperty set; } - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] public string PropertyAnnotationInPropertyAndAccessor { [RequiresAssemblyFiles("Message")] @@ -513,12 +513,12 @@ public string PropertyAnnotationInPropertyAndAccessor class ExplicitImplementationClassWithoutRequires : IBaseWithRequires { // ILLink member string format includes namespace of explicit interface method. - [ExpectedWarning("IL2046", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.Method()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3003", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.Method()", Tool.NativeAot, "")] - [ExpectedWarning("IL2046", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.IBaseWithRequires.Method()", Tool.Analyzer, "")] - [ExpectedWarning("IL3003", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.IBaseWithRequires.Method()", Tool.Analyzer, "")] - [ExpectedWarning("IL3051", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.IBaseWithRequires.Method()", Tool.Analyzer, "")] + [ExpectedWarning("IL2046", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.Method()", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT warn on explicit interface implementation mismatch")] + [ExpectedWarning("IL3003", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3051", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2046", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.IBaseWithRequires.Method()", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] + [ExpectedWarning("IL3003", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.IBaseWithRequires.Method()", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] + [ExpectedWarning("IL3051", "IBaseWithRequires.Method()", "ExplicitImplementationClassWithoutRequires.IBaseWithRequires.Method()", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] void IBaseWithRequires.Method() { } @@ -533,7 +533,7 @@ string IBaseWithRequires.PropertyAnnotationInAccesor set { name = value; } } - [ExpectedWarning("IL3003", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] string IBaseWithRequires.PropertyAnnotationInProperty { [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] @@ -542,7 +542,7 @@ string IBaseWithRequires.PropertyAnnotationInProperty set; } - [ExpectedWarning("IL3003", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] string IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor { [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] @@ -572,7 +572,7 @@ public string PropertyAnnotationInAccesor set { name = value; } } - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty", "IBaseWithRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty", "IBaseWithRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] public string PropertyAnnotationInProperty { [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty.get", "IBaseWithRequiresInReference.PropertyAnnotationInProperty.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] @@ -607,7 +607,7 @@ public string PropertyAnnotationInAccesor set { name = value; } } - [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty", "IBaseWithoutRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty", "IBaseWithoutRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer, "Analyzer limitation in requires attribute validation")] [RequiresAssemblyFiles("Message")] public string PropertyAnnotationInProperty { @@ -621,23 +621,23 @@ public string PropertyAnnotationInProperty class StaticInterfaceMethods { [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] public static void Test() { typeof(IRequires).RequiresPublicMethods(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresExcludeStatics.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresExcludeStatics.cs index da1008f16f5804..d21c049479f394 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresExcludeStatics.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresExcludeStatics.cs @@ -145,8 +145,8 @@ public static void Test() } } - [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()", "--BaseWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()", "--BaseWithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()", "--BaseWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()", "--BaseWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", "--BaseWithRequires--", Tool.Analyzer, "NativeAOT Specific warning")] [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", "--BaseWithRequires--", Tool.NativeAot, "NativeAOT Specific warning", CompilerGeneratedCode = true)] class DerivedWithoutRequires : BaseWithRequires diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInCompilerGeneratedCode.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInCompilerGeneratedCode.cs index d953a2a3e7454c..fbfb1972b68675 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInCompilerGeneratedCode.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresInCompilerGeneratedCode.cs @@ -70,8 +70,8 @@ static IEnumerable TestCallAfterYieldReturn() } [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static IEnumerable TestReflectionAccess() { yield return 0; @@ -82,15 +82,15 @@ static IEnumerable TestReflectionAccess() } #if !RELEASE - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] #else // In release mode, the compiler optimizes away the unused Action (and reference to MethodWithRequires) #endif - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] static IEnumerable TestLdftn() { yield return 0; @@ -112,8 +112,8 @@ static IEnumerable TestLazyDelegate() } [ExpectedWarning("IL2026", "--TypeWithMethodWithRequires.MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static IEnumerable TestDynamicallyAccessedMethod() { typeof(TypeWithMethodWithRequires).RequiresNonPublicMethods(); @@ -254,8 +254,8 @@ static async void TestCallAfterYieldReturn() } [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static async void TestReflectionAccess() { await MethodAsync(); @@ -266,13 +266,13 @@ static async void TestReflectionAccess() } #if !RELEASE - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] #endif - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] static async void TestLdftn() { await MethodAsync(); @@ -291,8 +291,8 @@ static async void TestLazyDelegate() } [ExpectedWarning("IL2026", "--TypeWithMethodWithRequires.MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static async void TestDynamicallyAccessedMethod() { typeof(TypeWithMethodWithRequires).RequiresNonPublicMethods(); @@ -431,8 +431,8 @@ static async IAsyncEnumerable TestCallAfterYieldReturn() } [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static async IAsyncEnumerable TestReflectionAccess() { yield return 0; @@ -445,13 +445,13 @@ static async IAsyncEnumerable TestReflectionAccess() } #if !RELEASE - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] #endif - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] static async IAsyncEnumerable TestLdftn() { await MethodAsync(); @@ -472,8 +472,8 @@ static async IAsyncEnumerable TestLazyDelegate() } [ExpectedWarning("IL2026", "--TypeWithMethodWithRequires.MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static async IAsyncEnumerable TestDynamicallyAccessedMethod() { typeof(TypeWithMethodWithRequires).RequiresNonPublicMethods(); @@ -659,8 +659,8 @@ static void TestReflectionAccess() LocalFunction(); [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] void LocalFunction() => typeof(RequiresInCompilerGeneratedCode) .GetMethod("MethodWithRequires", System.Reflection.BindingFlags.NonPublic) .Invoke(null, new object[] { }); @@ -671,13 +671,13 @@ static void TestLdftn() LocalFunction(); #if !RELEASE - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT warn on compiler-generated code accessing RUC")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] #endif - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] void LocalFunction() { var action = new Action(MethodWithRequires); @@ -704,8 +704,8 @@ static void TestDynamicallyAccessedMethod() LocalFunction(); [ExpectedWarning("IL2026", "--TypeWithMethodWithRequires.MethodWithRequires--")] - [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] void LocalFunction() => typeof(TypeWithMethodWithRequires).RequiresNonPublicMethods(); } @@ -950,8 +950,8 @@ public static void TestCallMethodWithRequiresInDynamicallyAccessedLocalFunction( } [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestSuppressionOnLocalFunction() { LocalFunction(); // This will produce a warning since the local function has Requires on it @@ -967,8 +967,8 @@ void LocalFunction(Type unknownType = null) } [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestSuppressionOnLocalFunctionWithAssignment() { LocalFunction(); // This will produce a warning since the local function has Requires on it @@ -987,8 +987,8 @@ void LocalFunction(Type unknownType = null) static Type typeWithNonPublicMethods; [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestSuppressionOnLocalFunctionWithNestedLocalFunction() { LocalFunction(); // This will produce a warning since the local function has Requires on it @@ -1002,9 +1002,9 @@ void LocalFunction() // ILLink doesn't have enough information to associate the Requires on LocalFunction // with this nested local function. - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] + [ExpectedWarning("IL3002", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot, "NativeAOT specific warning")] void NestedLocalFunction() => MethodWithRequires(); } } @@ -1052,8 +1052,8 @@ static void Outer(int i) LocalFunction(); [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] void LocalFunction() => MethodWithRequires(); } } @@ -1184,13 +1184,13 @@ static void TestCallWithClosureUnused(int p = 0) { Action _ = #if !RELEASE - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT warn on compiler-generated code accessing RUC")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] #endif - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] () => { p++; @@ -1202,8 +1202,8 @@ static void TestReflectionAccess() { Action _ = [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] () => { typeof(RequiresInCompilerGeneratedCode) @@ -1216,13 +1216,13 @@ static void TestLdftn() { Action _ = #if !RELEASE - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT warn on compiler-generated code accessing RUC")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] #endif - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer, "Analyzer-specific behavior")] () => { var action = new Action(MethodWithRequires); @@ -1246,8 +1246,8 @@ static void TestDynamicallyAccessedMethod() { Action _ = [ExpectedWarning("IL2026", "--TypeWithMethodWithRequires.MethodWithRequires--")] - [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TypeWithMethodWithRequires.MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] () => { typeof(TypeWithMethodWithRequires).RequiresNonPublicMethods(); @@ -1398,8 +1398,8 @@ static void TestGenericTypeParameterRequirement() } [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestSuppressionOnLambda() { var lambda = @@ -1412,8 +1412,8 @@ static void TestSuppressionOnLambda() } [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestSuppressionOnLambdaWithNestedLambda() { var lambda = @@ -1427,9 +1427,9 @@ static void TestSuppressionOnLambdaWithNestedLambda() // an IL reference to the generated lambda method, unlike local functions. // However, we don't make this association, for consistency with local functions. var nestedLambda = - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", Tool.NativeAot | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.NativeAot | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] + [ExpectedWarning("IL3002", Tool.NativeAot | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.NativeAot | Tool.NativeAot, "NativeAOT specific warning")] () => MethodWithRequires(); }; @@ -1479,8 +1479,8 @@ static void Outer(int i) { var lambda = [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] () => MethodWithRequires(); lambda(); @@ -1791,9 +1791,9 @@ IEnumerable IteratorLocalFunction() yield return 1; // Trimmer doesn't try to associate LocalFunction with IteratorLocalFunction - [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "--MethodWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT warn on compiler-generated code accessing RUC")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] void LocalFunction() => MethodWithRequires(); } } @@ -1867,8 +1867,8 @@ static async void TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress() } [ExpectedWarning("IL2026", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static IEnumerable TestIteratorOnlyReferencedViaReflectionWhichShouldWarn() { yield return 0; @@ -1876,8 +1876,8 @@ static IEnumerable TestIteratorOnlyReferencedViaReflectionWhichShouldWarn() } [ExpectedWarning("IL2026", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning", CompilerGeneratedCode = true)] static async void TestAsyncOnlyReferencedViaReflectionWhichShouldWarn() { await MethodAsync(); @@ -1885,22 +1885,22 @@ static async void TestAsyncOnlyReferencedViaReflectionWhichShouldWarn() } [ExpectedWarning("IL2026", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--")] - [ExpectedWarning("IL3002", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--")] - [ExpectedWarning("IL3002", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAll() { typeof(StateMachinesOnlyReferencedViaReflection).RequiresAll(); } [ExpectedWarning("IL2026", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--")] - [ExpectedWarning("IL3002", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestIteratorOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--")] - [ExpectedWarning("IL3002", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestAsyncOnlyReferencedViaReflectionWhichShouldSuppress--", Tool.NativeAot, "NativeAOT specific warning")] // NonPublicMethods doesn't warn for members emitted into compiler-generated state machine types. static void TestNonPublicMethods() { @@ -1990,14 +1990,14 @@ void LocalFunction() // Warnings for Reflection access to methods with Requires [ExpectedWarning("IL2026", "--TestLocalFunctionInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestLocalFunctionWithClosureInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAll() { typeof(LocalFunctionsReferencedViaReflection).RequiresAll(); @@ -2005,14 +2005,14 @@ static void TestAll() // Warnings for Reflection access to methods with Requires [ExpectedWarning("IL2026", "--TestLocalFunctionInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestLocalFunctionWithClosureInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionInMethodWithRequiresOnlyAccessedViaReflection--", Tool.NativeAot, "NativeAOT specific warning")] static void TestNonPublicMethods() { typeof(LocalFunctionsReferencedViaReflection).RequiresNonPublicMethods(); @@ -2085,11 +2085,11 @@ static void TestLambdaWithClosureInMethodWithRequires(int p = 0) // Warnings for Reflection access to methods with Requires [ExpectedWarning("IL2026", "--TestLambdaInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestLambdaWithClosureInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAll() { typeof(LambdasReferencedViaReflection).RequiresAll(); @@ -2097,11 +2097,11 @@ static void TestAll() // Warnings for Reflection access to methods with Requires [ExpectedWarning("IL2026", "--TestLambdaInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLambdaInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TestLambdaWithClosureInMethodWithRequires--")] - [ExpectedWarning("IL3002", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TestLambdaWithClosureInMethodWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestNonPublicMethods() { typeof(LambdasReferencedViaReflection).RequiresNonPublicMethods(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnAttribute.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnAttribute.cs index b22b50370af4fd..228e23f0a2bcaf 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnAttribute.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnAttribute.cs @@ -162,8 +162,8 @@ public void MethodWhichRequires() { } } [ExpectedWarning("IL2026", "--TypeWithMethodWhichRequires--")] - [ExpectedWarning("IL3002", "--TypeWithMethodWhichRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TypeWithMethodWhichRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TypeWithMethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TypeWithMethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] [AttributeWhichMarksPublicMethods(typeof(TypeWithMethodWhichRequires))] static void ShouldWarn() { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs index 439a665cf0f5dd..245905eab2dceb 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnClass.cs @@ -132,8 +132,8 @@ public DerivedFromNestedInRequiresClass() { } public static void StaticMethod() { } } - [ExpectedWarning("IL2026", "ClassWithRequires.ClassWithRequires()", "--ClassWithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL2026", "ClassWithRequires.ClassWithRequires()", "--ClassWithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "ClassWithRequires.ClassWithRequires()", "--ClassWithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", "ClassWithRequires.ClassWithRequires()", "--ClassWithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] [ExpectedWarning("IL3050", "ClassWithRequires.ClassWithRequires()", "--ClassWithRequires--", Tool.Analyzer, "NativeAOT Specific warning")] [ExpectedWarning("IL3050", "ClassWithRequires.ClassWithRequires()", "--ClassWithRequires--", Tool.NativeAot, "NativeAOT Specific warning", CompilerGeneratedCode = true)] class TestUnconditionalSuppressMessage : ClassWithRequires @@ -347,8 +347,8 @@ class BaseWithRequiresOnType public virtual void Method() { } } - [ExpectedWarning("IL2026", "BaseWithRequiresOnType.BaseWithRequiresOnType()", "RUC", Tool.Analyzer, "")] - [ExpectedWarning("IL2026", "BaseWithRequiresOnType.BaseWithRequiresOnType()", "RUC", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "BaseWithRequiresOnType.BaseWithRequiresOnType()", "RUC", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", "BaseWithRequiresOnType.BaseWithRequiresOnType()", "RUC", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] [ExpectedWarning("IL3050", "BaseWithRequiresOnType.BaseWithRequiresOnType()", "RDC", Tool.Analyzer, "NativeAOT Specific warning")] [ExpectedWarning("IL3050", "BaseWithRequiresOnType.BaseWithRequiresOnType()", "RDC", Tool.NativeAot, "NativeAOT Specific warning", CompilerGeneratedCode = true)] class DerivedWithoutRequiresOnType : BaseWithRequiresOnType @@ -532,25 +532,25 @@ static void TestNameOfDoesntWarn() class ReflectionAccessOnMethod { [ExpectedWarning("IL2026", "BaseWithRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "BaseWithRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseWithRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "BaseWithRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseWithoutRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "BaseWithoutRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithoutRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseWithoutRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "BaseWithoutRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithoutRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "InterfaceWithoutRequires.Method(Int32)")] - [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method(Int32)", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method(Int32)", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "InterfaceWithoutRequires.Method()")] - [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationWithRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationWithRequiresOnType.Method(Int32)")] - [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method(Int32)", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method(Int32)", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnTypeOverBaseWithNoRequires.Method()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnTypeOverBaseWithNoRequires.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnTypeOverBaseWithNoRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] static void TestDAMAccess() { // Warns because BaseWithoutRequiresOnType.Method has Requires on the method @@ -576,17 +576,17 @@ static void TestDAMAccess() } [ExpectedWarning("IL2026", "BaseWithRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "BaseWithRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseWithoutRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "BaseWithoutRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithoutRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "InterfaceWithoutRequires.Method(Int32)")] - [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method(Int32)", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method(Int32)", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "InterfaceWithoutRequires.Method()")] - [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "InterfaceWithoutRequires.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationWithRequiresOnType.Method()")] - [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "ImplementationWithRequiresOnType.Method(Int32)")] - [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method(Int32)", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "ImplementationWithRequiresOnType.Method(Int32)", Tool.NativeAot, "NativeAOT specific warning")] static void TestDirectReflectionAccess() { // Requires on the method itself @@ -643,15 +643,15 @@ public DerivedWithRequiresOnBaseWithoutRequires() { } } [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()")] - [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()")] - [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnBaseWithRequires.DerivedWithRequiresOnBaseWithRequires()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithRequires.DerivedWithRequiresOnBaseWithRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithRequires.DerivedWithRequiresOnBaseWithRequires()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()", Tool.NativeAot, "NativeAOT specific warning")] static void TestDAMAccess() { // Warns because the type has Requires @@ -668,11 +668,11 @@ static void TestDAMAccess() } [ExpectedWarning("IL2026", "BaseWithRequires.BaseWithRequires()")] - [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "BaseWithRequires.BaseWithRequires()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnBaseWithRequires.DerivedWithRequiresOnBaseWithRequires()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithRequires.DerivedWithRequiresOnBaseWithRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithRequires.DerivedWithRequiresOnBaseWithRequires()", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()")] - [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequiresOnBaseWithoutRequires.DerivedWithRequiresOnBaseWithoutRequires()", Tool.NativeAot, "NativeAOT specific warning")] static void TestDirectReflectionAccess() { typeof(BaseWithRequires).GetConstructor(Type.EmptyTypes); @@ -706,8 +706,8 @@ class WithRequiresOnlyInstanceFields public int InstanceField; } - [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] [ExpectedWarning("IL3050", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "NativeAOT Specific warning")] [ExpectedWarning("IL3050", "WithRequires.WithRequires()", "--WithRequires--", Tool.NativeAot, "NativeAOT Specific warning", CompilerGeneratedCode = true)] class DerivedWithoutRequires : WithRequires @@ -723,15 +723,15 @@ class DerivedWithRequires : WithRequires } [ExpectedWarning("IL2026", "WithRequires.StaticField")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticField")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticField")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.PrivateStaticField")] - [ExpectedWarning("IL3050", "WithRequires.PrivateStaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.PrivateStaticField", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticField")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticField", Tool.NativeAot, "NativeAOT specific warning")] static void TestDAMAccess() { typeof(WithRequires).RequiresPublicFields(); @@ -742,11 +742,11 @@ static void TestDAMAccess() } [ExpectedWarning("IL2026", "WithRequires.StaticField")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.PrivateStaticField")] - [ExpectedWarning("IL3050", "WithRequires.PrivateStaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.PrivateStaticField", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticField")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticField", Tool.NativeAot, "NativeAOT specific warning")] static void TestDirectReflectionAccess() { typeof(WithRequires).GetField(nameof(WithRequires.StaticField)); @@ -757,17 +757,17 @@ static void TestDirectReflectionAccess() typeof(DerivedWithRequires).GetField(nameof(DerivedWithRequires.DerivedStaticField)); } - [ExpectedWarning("IL2026", "WithRequires.StaticField", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticField", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticField", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "WithRequires.StaticField", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on field access")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticField", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on field access")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticField", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on field access")] + [ExpectedWarning("IL3050", "WithRequires.StaticField", Tool.NativeAot, "NativeAOT specific warning")] [DynamicDependency(nameof(WithRequires.StaticField), typeof(WithRequires))] [DynamicDependency(nameof(WithRequires.InstanceField), typeof(WithRequires))] // Doesn't warn [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields, typeof(DerivedWithoutRequires))] // Doesn't warn - [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticField", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticField", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticField", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on field access")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticField", Tool.NativeAot, "NativeAOT specific warning")] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields, typeof(DerivedWithRequires))] static void TestDynamicDependencyAccess() { @@ -822,14 +822,14 @@ class GenericTypeWithRequires } [ExpectedWarning("IL2026", "NonGenericField", "--GenericTypeWithRequires--")] - [ExpectedWarning("IL3050", "NonGenericField", "--GenericTypeWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "NonGenericField", "--GenericTypeWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestDAMAccessOnOpenGeneric() { typeof(GenericTypeWithRequires<>).RequiresPublicFields(); } [ExpectedWarning("IL2026", "NonGenericField", "--GenericTypeWithRequires--")] - [ExpectedWarning("IL3050", "NonGenericField", "--GenericTypeWithRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "NonGenericField", "--GenericTypeWithRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestDAMAccessOnInstantiatedGeneric() { typeof(GenericTypeWithRequires).RequiresPublicFields(); @@ -873,8 +873,8 @@ class DerivedRequires : WithRequires private event EventHandler DerivedPrivateInstanceEvent; } - [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] [ExpectedWarning("IL3050", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "NativeAOT Specific warning")] [ExpectedWarning("IL3050", "WithRequires.WithRequires()", "--WithRequires--", Tool.NativeAot, "NativeAOT Specific warning", CompilerGeneratedCode = true)] class DerivedWithoutRequires : WithRequires @@ -885,13 +885,13 @@ class DerivedWithoutRequires : WithRequires } [ExpectedWarning("IL2026", "StaticEvent.add")] - [ExpectedWarning("IL3050", "StaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "StaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "StaticEvent.remove")] - [ExpectedWarning("IL3050", "StaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "StaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedStaticEvent.add")] - [ExpectedWarning("IL3050", "DerivedStaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedStaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedStaticEvent.remove")] - [ExpectedWarning("IL3050", "DerivedStaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedStaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void ReflectOverSingleEvent() { typeof(WithRequires).GetEvent(nameof(WithRequires.StaticEvent)); @@ -900,59 +900,59 @@ static void ReflectOverSingleEvent() } [ExpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "PrivateInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "PrivateInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void ReflectOverAllEvents() { typeof(WithRequires).GetEvents(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [UnexpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.add", Tool.All, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.remove", Tool.All, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102525")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedStaticEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedStaticEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void DerivedReflectOverAllEvents() { typeof(DerivedRequires).GetEvents(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } [ExpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "PrivateInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "PrivateInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void RequiresAllEvents() { RequiresAllEvents(typeof(WithRequires)); @@ -962,25 +962,25 @@ static void RequiresAllEvents([DynamicallyAccessedMembers(DynamicallyAccessedMem } [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [UnexpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.add", Tool.All, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.remove", Tool.All, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102525")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedStaticEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedStaticEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void DerivedRequiresAllEvents() { RequiresAllEvents(typeof(DerivedRequires)); @@ -990,52 +990,52 @@ static void RequiresAllEvents([DynamicallyAccessedMembers(DynamicallyAccessedMem } [ExpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void RequiresPublicEvents() { typeof(WithRequires).RequiresPublicEvents(); } [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "InstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "InstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [UnexpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.add", Tool.All, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL2026", nameof(WithRequires), "StaticEvent.remove", Tool.All, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.add", Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102525")] [UnexpectedWarning("IL3050", nameof(WithRequires), "StaticEvent.remove", Tool.NativeAot, "https://github.com/dotnet/runtime/issues/102525")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedStaticEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedStaticEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedStaticEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void DerivedRequiresPublicEvents() { typeof(DerivedRequires).RequiresPublicEvents(); } [ExpectedWarning("IL2026", nameof(WithRequires), "PrivateInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(WithRequires), "PrivateInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(WithRequires), "PrivateInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void RequiresNonPublicEvents() { typeof(WithRequires).RequiresNonPublicEvents(); } [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.add", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove")] - [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(DerivedRequires), "DerivedPrivateInstanceEvent.remove", Tool.NativeAot, "NativeAOT specific warning")] static void DerivedRequiresNonPublicEvents() { typeof(DerivedRequires).RequiresNonPublicEvents(); @@ -1076,8 +1076,8 @@ class WithRequiresOnlyInstanceProperties public int InstanceProperty { get; set; } } - [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "")] - [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", "WithRequires.WithRequires()", "--WithRequires--", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT do not warn on compiler-generated code", CompilerGeneratedCode = true)] [ExpectedWarning("IL3050", "WithRequires.WithRequires()", "--WithRequires--", Tool.Analyzer, "NativeAOT Specific warning")] [ExpectedWarning("IL3050", "WithRequires.WithRequires()", "--WithRequires--", Tool.NativeAot, "NativeAOT Specific warning", CompilerGeneratedCode = true)] class DerivedWithoutRequires : WithRequires @@ -1093,41 +1093,41 @@ class DerivedWithRequires : WithRequires } [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.PrivateStaticProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.PrivateStaticProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequiresOnlyInstanceProperties.InstanceProperty.get")] - [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequiresOnlyInstanceProperties.InstanceProperty.set")] - [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.get")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.set")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] static void TestDAMAccess() { typeof(WithRequires).RequiresPublicProperties(); @@ -1138,25 +1138,25 @@ static void TestDAMAccess() } [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.PrivateStaticProperty.get")] - [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequires.PrivateStaticProperty.set")] - [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequires.PrivateStaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequiresOnlyInstanceProperties.InstanceProperty.get")] - [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "WithRequiresOnlyInstanceProperties.InstanceProperty.set")] - [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "WithRequiresOnlyInstanceProperties.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.get")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.get", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.set")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] static void TestDirectReflectionAccess() { typeof(WithRequires).GetProperty(nameof(WithRequires.StaticProperty)); @@ -1167,37 +1167,37 @@ static void TestDirectReflectionAccess() typeof(DerivedWithRequires).GetProperty(nameof(DerivedWithRequires.DerivedStaticProperty)); } - [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.InstanceProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.InstanceProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "WithRequires.StaticProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "WithRequires.StaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [DynamicDependency(nameof(WithRequires.StaticProperty), typeof(WithRequires))] [DynamicDependency(nameof(WithRequires.InstanceProperty), typeof(WithRequires))] // Doesn't warn [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(DerivedWithoutRequires))] // Doesn't warn - [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.get", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.get", Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.set", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.set", Tool.NativeAot, "")] + [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.get", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.get", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL2026", "DerivedWithRequires.DerivedStaticProperty.set", Tool.Trimmer | Tool.NativeAot, "Type-level RUC warning on property access")] + [ExpectedWarning("IL3050", "DerivedWithRequires.DerivedStaticProperty.set", Tool.NativeAot, "NativeAOT specific warning")] [DynamicDependency(DynamicallyAccessedMemberTypes.PublicProperties, typeof(DerivedWithRequires))] static void TestDynamicDependencyAccess() { @@ -1322,7 +1322,7 @@ public static void Test() { } } [ExpectedWarning("IL2026")] - [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] public static void Test() { TestClass.Test(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnStaticConstructor.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnStaticConstructor.cs index 6a8df3d20a05dc..220a5dfc4c1246 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnStaticConstructor.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnStaticConstructor.cs @@ -70,8 +70,8 @@ static void TestRunClassConstructorOnTypeWithRequires() class StaticCtorForRunClassConstructorWithRequires { [ExpectedWarning("IL2116")] - [ExpectedWarning("IL3004", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3056", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3004", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3056", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] [RequiresUnreferencedCode("Message for --StaticCtorOnTypeWithRequires--")] [RequiresAssemblyFiles("Message for --StaticCtorOnTypeWithRequires--")] [RequiresDynamicCode("Message for --StaticCtorOnTypeWithRequires--")] @@ -146,9 +146,9 @@ static void TestStaticCtorTriggeredByMethodCall() class TypeIsBeforeFieldInit { - [ExpectedWarning("IL2026", "Message from --TypeIsBeforeFieldInit.AnnotatedMethod--", Tool.Analyzer, "")] - [ExpectedWarning("IL3002", "Message from --TypeIsBeforeFieldInit.AnnotatedMethod--", Tool.Analyzer, "")] - [ExpectedWarning("IL3050", "Message from --TypeIsBeforeFieldInit.AnnotatedMethod--", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", "Message from --TypeIsBeforeFieldInit.AnnotatedMethod--", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL3002", "Message from --TypeIsBeforeFieldInit.AnnotatedMethod--", Tool.Analyzer, "Analyzer-specific behavior")] + [ExpectedWarning("IL3050", "Message from --TypeIsBeforeFieldInit.AnnotatedMethod--", Tool.Analyzer, "Analyzer-specific behavior")] public static int field = AnnotatedMethod(); [RequiresUnreferencedCode("Message from --TypeIsBeforeFieldInit.AnnotatedMethod--")] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnVirtualsAndInterfaces.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnVirtualsAndInterfaces.cs index 029c062a3f6e33..3ad8e6ef660115 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnVirtualsAndInterfaces.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresOnVirtualsAndInterfaces.cs @@ -73,11 +73,11 @@ static void TestCallOnOverrideViaBase() } [ExpectedWarning("IL2026", "--BaseType.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TypeWhichOverridesMethod.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestDirectReflectionAccess() { BaseType tmp = new TypeWhichOverridesMethod(); @@ -90,11 +90,11 @@ static void TestDirectReflectionAccess() } [ExpectedWarning("IL2026", "--BaseType.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--TypeWhichOverridesMethod.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAnnotatedReflectionAccess() { CallMethodWithRequiresOnInstance(new TypeWhichOverridesMethod()); @@ -191,8 +191,8 @@ static void TestCallViaImplementationClass() } [ExpectedWarning("IL2026", "--ImplementationClass.RequiresMethod--")] - [ExpectedWarning("IL3002", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "NativeAOT specific warning")] static void TestDirectReflectionAccess() { typeof(ImplementationClass).GetMethod("MethodWithRequires").Invoke(new ImplementationClass(), Array.Empty()); @@ -204,8 +204,8 @@ static void TestDirectReflectionAccess() } [ExpectedWarning("IL2026", "--ImplementationClass.RequiresMethod--")] - [ExpectedWarning("IL3002", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--ImplementationClass.RequiresMethod--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAnnotatedReflectionAccess() { CallMethodWithRequiresOnInstance(new ImplementationClass()); @@ -307,12 +307,12 @@ public virtual void RUCMethod() { } [ExpectedWarning("IL2026", "Message for --NewSlotVirtual.Base.RUCMethod--")] // Reflection triggered warnings are not produced by analyzer for RDC/RAS - [ExpectedWarning("IL3002", "Message for --NewSlotVirtual.Base.RUCMethod--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --NewSlotVirtual.Base.RUCMethod--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Message for --NewSlotVirtual.Base.RUCMethod--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "Message for --NewSlotVirtual.Base.RUCMethod--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "Message for --NewSlotVirtual.Derived.RUCMethod--")] // Reflection triggered warnings are not produced by analyzer for RDC/RAS - [ExpectedWarning("IL3002", "Message for --NewSlotVirtual.Derived.RUCMethod--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --NewSlotVirtual.Derived.RUCMethod--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Message for --NewSlotVirtual.Derived.RUCMethod--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "Message for --NewSlotVirtual.Derived.RUCMethod--", Tool.NativeAot, "NativeAOT specific warning")] public static void Test() { typeof(Derived).RequiresPublicMethods(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs index dc8a1dc5286a0d..fd9103a3057276 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaDataflow.cs @@ -60,11 +60,11 @@ public override void VirtualMethodRequires() } [ExpectedWarning("IL2026", "TypeWhichOverridesMethod.VirtualMethodRequires()", "--TypeWhichOverridesMethod.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "TypeWhichOverridesMethod.VirtualMethodRequires()", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "TypeWhichOverridesMethod.VirtualMethodRequires()", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "TypeWhichOverridesMethod.VirtualMethodRequires()", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "TypeWhichOverridesMethod.VirtualMethodRequires()", "--TypeWhichOverridesMethod.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "BaseType.VirtualMethodRequires()", "--BaseType.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "BaseType.VirtualMethodRequires()", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "BaseType.VirtualMethodRequires()", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "BaseType.VirtualMethodRequires()", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "BaseType.VirtualMethodRequires()", "--BaseType.VirtualMethodRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestOverriddenVirtualMethod() { MethodWithAnnotatedParameter(typeof(TypeWhichOverridesMethod)); @@ -93,8 +93,8 @@ public TypeWithPublicMethods() { } } [ExpectedWarning("IL2026", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--")] - [ExpectedWarning("IL3002", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAccessOnGenericType() { new TypeWithPublicMethods(); @@ -103,8 +103,8 @@ static void TestAccessOnGenericType() static void MethodWithPublicMethods<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>() { } [ExpectedWarning("IL2026", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--")] - [ExpectedWarning("IL3002", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAccessOnGenericMethod() { MethodWithPublicMethods(); @@ -113,8 +113,8 @@ static void TestAccessOnGenericMethod() static void MethodWithPublicMethodsInference<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(T instance) { } [ExpectedWarning("IL2026", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--")] - [ExpectedWarning("IL3002", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--AccessedThroughGenericParameterAnnotation.TypeWithRequiresMethod.MethodWhichRequires--", Tool.NativeAot, "NativeAOT specific warning")] static void TestAccessOnGenericMethodWithInferenceOnMethod() { MethodWithPublicMethodsInference(new TypeWithRequiresMethod()); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaXml.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaXml.cs index 9806ef8689143e..f067c1abd26ba9 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaXml.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresViaXml.cs @@ -17,7 +17,7 @@ class RequiresViaXml // The second attribute is added through link attribute XML [RequiresUnreferencedCode("Message for --MethodWithDuplicateRequiresAttribute--")] - [ExpectedWarning("IL2027", "RequiresUnreferencedCodeAttribute", nameof(MethodWithDuplicateRequiresAttribute), Tool.Trimmer, "")] + [ExpectedWarning("IL2027", "RequiresUnreferencedCodeAttribute", nameof(MethodWithDuplicateRequiresAttribute), Tool.Trimmer, "Trimmer-specific duplicate attribute detection")] static void MethodWithDuplicateRequiresAttribute() { } diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs index 229193048fb202..85be89a0e3638e 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/RequiresCapability/RequiresWithCopyAssembly.cs @@ -29,11 +29,11 @@ namespace Mono.Linker.Tests.Cases.RequiresCapability class RequiresWithCopyAssembly { [ExpectedWarning("IL2026", "--IDerivedInterface.MethodInDerivedInterface--")] - [ExpectedWarning("IL3002", "--IDerivedInterface.MethodInDerivedInterface--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--IDerivedInterface.MethodInDerivedInterface--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--IDerivedInterface.MethodInDerivedInterface--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--IDerivedInterface.MethodInDerivedInterface--", Tool.NativeAot, "NativeAOT specific warning")] [ExpectedWarning("IL2026", "--IBaseInterface.MethodInBaseInterface--")] - [ExpectedWarning("IL3002", "--IBaseInterface.MethodInBaseInterface--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--IBaseInterface.MethodInBaseInterface--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--IBaseInterface.MethodInBaseInterface--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--IBaseInterface.MethodInBaseInterface--", Tool.NativeAot, "NativeAOT specific warning")] public static void Main() { TestRequiresInMethodFromCopiedAssembly(); @@ -51,8 +51,8 @@ static void TestRequiresInMethodFromCopiedAssembly() } [ExpectedWarning("IL2026", "--MethodCalledThroughReflection--")] - [ExpectedWarning("IL3002", "--MethodCalledThroughReflection--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodCalledThroughReflection--", Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodCalledThroughReflection--", Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3050", "--MethodCalledThroughReflection--", Tool.NativeAot, "NativeAOT specific warning")] static void TestRequiresThroughReflectionInMethodFromCopiedAssembly() { typeof(RequiresInCopyAssembly) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/SingleFile/SingleFileIntrinsics.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/SingleFile/SingleFileIntrinsics.cs index a9d52af7883275..6ba23b86dcc4b3 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/SingleFile/SingleFileIntrinsics.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/SingleFile/SingleFileIntrinsics.cs @@ -27,7 +27,7 @@ public static void Main() TestAssemblyGetFilesSuppressedByRAF(); } - [ExpectedWarning("IL3000", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3000", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestAssemblyLocation() { var a = typeof(SingleFileIntrinsics).Assembly.Location; @@ -39,7 +39,7 @@ static void TestAssemblyLocationSuppressedByRAF() var a = typeof(SingleFileIntrinsics).Assembly.Location; } - [ExpectedWarning("IL3000", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3000", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestAssemblyNameCodeBase() { var a = typeof(SingleFileIntrinsics).Assembly.GetName().CodeBase; @@ -51,7 +51,7 @@ static void TestAssemblyNameCodeBaseSuppressedByRAF() var a = typeof(SingleFileIntrinsics).Assembly.GetName().CodeBase; } - [ExpectedWarning("IL3000", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3000", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestAssemblyNameEscapedCodeBase() { var a = typeof(SingleFileIntrinsics).Assembly.GetName().EscapedCodeBase; @@ -63,7 +63,7 @@ static void TestAssemblyNameEscapedCodeBaseSuppressedByRAF() var a = typeof(SingleFileIntrinsics).Assembly.GetName().EscapedCodeBase; } - [ExpectedWarning("IL3001", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3001", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestAssemblyGetFile() { var a = typeof(SingleFileIntrinsics).Assembly.GetFile("unknown"); @@ -75,8 +75,8 @@ static void TestAssemblyGetFileSuppressedByRAF() var a = typeof(SingleFileIntrinsics).Assembly.GetFile("unknown"); } - [ExpectedWarning("IL3001", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3001", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3001", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] + [ExpectedWarning("IL3001", Tool.Analyzer | Tool.NativeAot, "NativeAOT specific warning")] static void TestAssemblyGetFiles() { var a = typeof(SingleFileIntrinsics).Assembly.GetFiles(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs index 4ae4d36e72d643..9d674fe64582e9 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs @@ -95,8 +95,8 @@ static void TestGuardAssemblyFiles() RequiresAssemblyFiles(); } - [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "")] - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [FeatureGuard(typeof(RequiresDynamicCodeAttribute))] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool GuardDynamicCodeAndUnreferencedCode => RuntimeFeature.IsDynamicCodeSupported && TestFeatures.IsUnreferencedCodeSupported; @@ -157,7 +157,7 @@ static void TestIndirectGuard() [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitch")] static bool FeatureSwitch => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitch", out bool isEnabled) && isEnabled; - [ExpectedWarning("IL2026", Tool.Analyzer, "")] // Analyzer doesn't respect FeatureSwitchDefinition or feature settings + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] // Analyzer doesn't respect FeatureSwitchDefinition or feature settings [ExpectedInstructionSequence(new[] { "nop", "ldc.i4.0", @@ -174,7 +174,7 @@ static void TestFeatureSwitch() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitchAndGuard")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool FeatureSwitchAndGuard => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitchAndGuard", out bool isEnabled) && isEnabled; @@ -274,7 +274,7 @@ public static void Test() [Kept] class FeatureGuardPrecedence { - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.FeatureGuardPrecedence.GuardAndSwitch")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool GuardAndSwitch => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.FeatureGuardPrecedence.GuardAndSwitch", out bool isEnabled) && isEnabled; @@ -291,7 +291,7 @@ class FeatureGuardPrecedence "ret" })] // ILLink/ILCompiler ignore FeatureGuard on properties that also have FeatureSwitchDefinition - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] static void TestSwitchWinsOverGuard() { if (GuardAndSwitch) @@ -301,7 +301,7 @@ static void TestSwitchWinsOverGuard() [Kept] [KeptAttributeAttribute(typeof(FeatureSwitchDefinitionAttribute))] [KeptAttributeAttribute(typeof(FeatureGuardAttribute))] - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.FeatureGuardPrecedence.GuardAndSwitchNotSet")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool GuardAndSwitchNotSet @@ -312,7 +312,7 @@ static bool GuardAndSwitchNotSet [Kept] // No IL modifications because feature is not set, and FeatureGuard is ignored due to FeatureSwitchDefinition. - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] static void TestSwitchNotSetWinsOverGuard() { if (GuardAndSwitchNotSet) @@ -333,7 +333,7 @@ static void TestSwitchNotSetWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] static void TestXmlWinsOverGuard() { if (GuardWithXml) @@ -342,7 +342,7 @@ static void TestXmlWinsOverGuard() [KeptAttributeAttribute(typeof(FeatureSwitchDefinitionAttribute))] [KeptAttributeAttribute(typeof(FeatureGuardAttribute))] - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.FeatureGuardPrecedence.SwitchWithXml")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool SwitchWithXml => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.FeatureGuardPrecedence.SwitchWithXml", out bool isEnabled) && isEnabled; @@ -359,7 +359,7 @@ static void TestXmlWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] static void TestXmlWinsOverSwitch() { if (SwitchWithXml) @@ -368,7 +368,7 @@ static void TestXmlWinsOverSwitch() [KeptAttributeAttribute(typeof(FeatureSwitchDefinitionAttribute))] [KeptAttributeAttribute(typeof(FeatureGuardAttribute))] - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardPrecedence.GuardAndSwitchWithXml")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool GuardAndSwitchWithXml => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.FeatureGuardPrecedence.GuardAndSwitchWithXml", out bool isEnabled) && isEnabled; @@ -385,7 +385,7 @@ static void TestXmlWinsOverSwitch() "nop", "ret" })] - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] static void TestXmlWinsOverGuardAndSwitch() { if (GuardAndSwitchWithXml) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs index 25a941233724aa..29497dbb97eff2 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs @@ -25,7 +25,7 @@ public static void Main() } [Kept] - [ExpectedWarning("IL4000", Tool.Analyzer, "")] + [ExpectedWarning("IL4000", Tool.Analyzer, "Analyzer does not support feature guard substitutions")] [KeptAttributeAttribute(typeof(FeatureGuardAttribute))] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool GuardUnreferencedCode @@ -47,7 +47,7 @@ static void TestGuard() static bool FeatureSwitch => throw null; [Kept] - [ExpectedWarning("IL2026", Tool.Analyzer, "")] + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] // Feature switches are still substituted when feature guard substitutions are disabled [ExpectBodyModified] static void TestFeatureSwitch() diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInModule.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInModule.cs index be1470ff1c91ba..5158aa8f58f1ed 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInModule.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInModule.cs @@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis; using Mono.Linker.Tests.Cases.Expectations.Assertions; -[assembly: ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] +[assembly: ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "Trimmer-specific redundant suppression detection")] [module: UnconditionalSuppressMessage("Test", "IL2071:Redundant suppression, warning is not issued in this assembly")] From 8f865a20b1bd45c451b5ae64963f0f20002eafc6 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:22:53 -0800 Subject: [PATCH 3/7] Apply suggestions from code review --- .../DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs index eb50a90959f144..90b426e7f07a26 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeInPreservedAssembly.cs @@ -42,7 +42,7 @@ public static void WithLocalFunctionInner() } // Analyzer doesn't implement constant propagation and branch removal, so it reaches this code - [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not implement constant prop and branch removal")] void LocalWithWarning() { // No warning @@ -63,7 +63,7 @@ public static void WithLocalFunction() } // Analyzer doesn't implement constant propagation and branch removal, so it reaches this code - [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not implement constant prop and branch removal")] void LocalWithWarning() { Requires(); From 8a773473bb32c8e47f503221aff0f192b9deb19b Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:30:23 -0800 Subject: [PATCH 4/7] Apply suggestion from @jtschuster --- .../Substitutions/FeatureGuardSubstitutionsDisabled.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs index 29497dbb97eff2..a8cf6c7f9d32d3 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutionsDisabled.cs @@ -47,7 +47,7 @@ static void TestGuard() static bool FeatureSwitch => throw null; [Kept] - [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] + [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not suport feature guard substitutions")] // Feature switches are still substituted when feature guard substitutions are disabled [ExpectBodyModified] static void TestFeatureSwitch() From c625a782e1c1e5f75ed824aa0cc3833ca2418fef Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Tue, 20 Jan 2026 16:32:43 -0800 Subject: [PATCH 5/7] Apply suggestions from code review --- .../Substitutions/FeatureGuardSubstitutions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs index 9d674fe64582e9..d2119ec00f9ced 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs @@ -157,7 +157,7 @@ static void TestIndirectGuard() [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitch")] static bool FeatureSwitch => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitch", out bool isEnabled) && isEnabled; - [ExpectedWarning("IL2026", Tool.Analyzer, "Analyzer does not support compiler-generated code warning suppression")] // Analyzer doesn't respect FeatureSwitchDefinition or feature settings + [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] // Analyzer doesn't respect FeatureSwitchDefinition or feature settings [ExpectedInstructionSequence(new[] { "nop", "ldc.i4.0", @@ -291,7 +291,7 @@ class FeatureGuardPrecedence "ret" })] // ILLink/ILCompiler ignore FeatureGuard on properties that also have FeatureSwitchDefinition - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] + [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestSwitchWinsOverGuard() { if (GuardAndSwitch) @@ -312,7 +312,7 @@ static bool GuardAndSwitchNotSet [Kept] // No IL modifications because feature is not set, and FeatureGuard is ignored due to FeatureSwitchDefinition. - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] + [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestSwitchNotSetWinsOverGuard() { if (GuardAndSwitchNotSet) @@ -333,7 +333,7 @@ static void TestSwitchNotSetWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] + [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestXmlWinsOverGuard() { if (GuardWithXml) @@ -359,7 +359,7 @@ static void TestXmlWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Trimmer/NativeAOT specific warning")] + [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestXmlWinsOverSwitch() { if (SwitchWithXml) From e7c09788e8f720e73beba8249aecafcdce2d34f8 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Mon, 26 Jan 2026 13:17:45 -0800 Subject: [PATCH 6/7] Apply suggestions from code review --- .../Substitutions/FeatureGuardSubstitutions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs index d2119ec00f9ced..5ae0492b52cb44 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs @@ -157,7 +157,7 @@ static void TestIndirectGuard() [FeatureSwitchDefinition("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitch")] static bool FeatureSwitch => AppContext.TryGetSwitch("Mono.Linker.Tests.Cases.Substitutions.FeatureGuardSubstitutions.DefineFeatureGuard.FeatureSwitch", out bool isEnabled) && isEnabled; - [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] // Analyzer doesn't respect FeatureSwitchDefinition or feature settings + [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] // Analyzer doesn't respect FeatureSwitchDefinition or feature settings [ExpectedInstructionSequence(new[] { "nop", "ldc.i4.0", @@ -291,7 +291,7 @@ class FeatureGuardPrecedence "ret" })] // ILLink/ILCompiler ignore FeatureGuard on properties that also have FeatureSwitchDefinition - [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestSwitchWinsOverGuard() { if (GuardAndSwitch) @@ -312,7 +312,7 @@ static bool GuardAndSwitchNotSet [Kept] // No IL modifications because feature is not set, and FeatureGuard is ignored due to FeatureSwitchDefinition. - [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestSwitchNotSetWinsOverGuard() { if (GuardAndSwitchNotSet) @@ -333,7 +333,7 @@ static void TestSwitchNotSetWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestXmlWinsOverGuard() { if (GuardWithXml) @@ -359,7 +359,7 @@ static void TestXmlWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL4000", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] static void TestXmlWinsOverSwitch() { if (SwitchWithXml) From 662f728cce6f9ac5f2a7ec672c9445656a019c19 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 26 Jan 2026 22:03:16 +0000 Subject: [PATCH 7/7] Fix Tool parameter in FeatureGuardSubstitutions - revert from Tool.Analyzer to Tool.Trimmer | Tool.NativeAot Co-authored-by: jtschuster <36744439+jtschuster@users.noreply.github.com> --- .../Substitutions/FeatureGuardSubstitutions.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs index 5ae0492b52cb44..d4088679efabd4 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Substitutions/FeatureGuardSubstitutions.cs @@ -291,7 +291,7 @@ class FeatureGuardPrecedence "ret" })] // ILLink/ILCompiler ignore FeatureGuard on properties that also have FeatureSwitchDefinition - [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Analyzer does not support feature guard substitutions")] static void TestSwitchWinsOverGuard() { if (GuardAndSwitch) @@ -312,7 +312,7 @@ static bool GuardAndSwitchNotSet [Kept] // No IL modifications because feature is not set, and FeatureGuard is ignored due to FeatureSwitchDefinition. - [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Analyzer does not support feature guard substitutions")] static void TestSwitchNotSetWinsOverGuard() { if (GuardAndSwitchNotSet) @@ -333,7 +333,7 @@ static void TestSwitchNotSetWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Analyzer does not support feature guard substitutions")] static void TestXmlWinsOverGuard() { if (GuardWithXml) @@ -359,7 +359,7 @@ static void TestXmlWinsOverGuard() "nop", "ret" })] - [ExpectedWarning("IL2026", nameof(RequiresDynamicCodeAttribute), Tool.Analyzer, "Analyzer does not support feature guard substitutions")] + [ExpectedWarning("IL2026", Tool.Trimmer | Tool.NativeAot, "Analyzer does not support feature guard substitutions")] static void TestXmlWinsOverSwitch() { if (SwitchWithXml)