diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeDataflow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeDataflow.cs index c5b8b6ab40b8a7..e8c94f3b7b5cbc 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeDataflow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/CompilerGeneratedCodeDataflow.cs @@ -38,8 +38,8 @@ static IEnumerable FlowAcrossYieldReturn() } // Trimmer tracks all assignments of hoisted locals, so this produces warnings. - [ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL2072", [nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods)], Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [UnexpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)] + [UnexpectedWarning("IL2072", [nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods)], Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)] static IEnumerable NoFlowAcrossYieldReturn() { Type t = GetWithPublicMethods(); @@ -226,8 +226,8 @@ static async void FlowAcrossAwait() } // Trimmer tracks all assignments of hoisted locals, so this produces warnings. - [ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL2072", nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods), Tool.Trimmer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2072", nameof(GetWithPublicMethods), nameof(DataFlowTypeExtensions.RequiresPublicFields), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)] + [ExpectedWarning("IL2072", nameof(GetWithPublicFields), nameof(DataFlowTypeExtensions.RequiresPublicMethods), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117155", CompilerGeneratedCode = true)] static async void NoFlowAcrossAwait() { Type t = GetWithPublicMethods(); @@ -454,7 +454,7 @@ public static void ReadCapturedParameterAfterWrite(Type tParameter = null) void LocalFunction() => tParameter.RequiresPublicMethods(); } - [ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "")] + [ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117155")] public static void ReadCapturedParameterAfterWriteMismatch([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type tParameter = null) { tParameter = GetWithPublicFields(); @@ -585,7 +585,7 @@ public static void ReadCapturedParameterAfterWrite(Type tParameter = null) lambda(); } - [ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "")] + [ExpectedWarning("IL2072", ["tParameter", nameof(GetWithPublicFields)], Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117155")] public static void ReadCapturedParameterAfterWriteMismatch([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type tParameter = null) { tParameter = GetWithPublicFields(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExceptionalDataFlow.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExceptionalDataFlow.cs index 952b8177d3d254..d434db1fd3fca9 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExceptionalDataFlow.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/ExceptionalDataFlow.cs @@ -46,8 +46,8 @@ public static void Main() ExceptionFilterWithException(); } - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void TryFlowsToFinally() { @@ -120,9 +120,9 @@ public static void MultipleTryExits() // On each path, only one state is possible, but we conservatively merge the (non-exceptional) // finally states for each path and expect the warnings to reflect this merged state. [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] @@ -132,9 +132,9 @@ public static void MultipleTryExits() [ExpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicEvents) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [UnexpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [UnexpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [UnexpectedWarning("IL2073", nameof(MultipleFinallyPaths) + "()", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] public static Type MultipleFinallyPaths() { @@ -172,11 +172,11 @@ public static Type MultipleFinallyPaths() throw new Exception(); } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void FinallyChain() { @@ -199,12 +199,12 @@ public static void FinallyChain() } } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicProperties) + "()")] @@ -235,8 +235,8 @@ public static void FinallyChainWithPostFinallyState() RequireAll4(t); } - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void TryFlowsToCatch() { @@ -253,8 +253,8 @@ public static void TryFlowsToCatch() } } - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void CatchFlowsToFinally() { @@ -274,7 +274,7 @@ public static void CatchFlowsToFinally() } } - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void CatchFlowsToAfterTry() { @@ -291,7 +291,7 @@ public static void CatchFlowsToAfterTry() RequireAll(t); } - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void CatchFlowsToAfterFinally() { @@ -332,17 +332,17 @@ public class Exception2 : Exception { } [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll5) + "(Type)", nameof(GetWithPublicEvents) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll6) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll6) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll6) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll6) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll6) + "(Type)", nameof(GetWithPublicEvents) + "()")] @@ -352,16 +352,16 @@ public class Exception2 : Exception { } [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicConstructors) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll5) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll5) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll7) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll7) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll7) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll5) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll5) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll7) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll7) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll7) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void TryFlowsToMultipleCatchAndFinally() { @@ -393,15 +393,15 @@ public static void TryFlowsToMultipleCatchAndFinally() } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicConstructors) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicConstructors) + "()")] public static void NestedWithFinally() @@ -432,14 +432,14 @@ public static void NestedWithFinally() } } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicEvents) + "()")] @@ -476,16 +476,16 @@ public static void ControlFlowsOutOfMultipleFinally() } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicConstructors) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicEvents) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicConstructors) + "()")] public static void NestedWithCatch() @@ -518,7 +518,7 @@ public static void NestedWithCatch() [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void CatchInTry() { try @@ -548,7 +548,7 @@ public static void CatchInTry() // [ExpectedSharedWarning ("IL2072", nameof (RequireAll2) + "(Type)", nameof (GetWithPublicConstructors) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void CatchInTryWithFinally() { Type t = GetWithPublicConstructors(); @@ -582,10 +582,10 @@ public static void CatchInTryWithFinally() } } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicConstructors) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicConstructors) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicConstructors) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicConstructors) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] static void CatchInFinally() @@ -612,7 +612,7 @@ static void CatchInFinally() [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void TestCatchesHaveSeparateState() { Type t = GetWithPublicMethods(); @@ -634,7 +634,7 @@ public static void TestCatchesHaveSeparateState() } [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] public static void FinallyWithBranchToFirstBlock() { Type t = GetWithPublicMethods(); @@ -651,7 +651,7 @@ public static void FinallyWithBranchToFirstBlock() } [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] public static void FinallyWithBranchToFirstBlockAndEnclosingTryCatchState() { try @@ -679,7 +679,7 @@ public static void FinallyWithBranchToFirstBlockAndEnclosingTryCatchState() } [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] public static void CatchWithBranchToFirstBlock() { Type t = GetWithPublicMethods(); @@ -696,7 +696,7 @@ public static void CatchWithBranchToFirstBlock() } [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] public static void CatchWithBranchToFirstBlockAndReassignment() { Type t = GetWithPublicMethods(); @@ -715,8 +715,8 @@ public static void CatchWithBranchToFirstBlockAndReassignment() [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void CatchWithNonSimplePredecessor() { @@ -744,8 +744,8 @@ public static void CatchWithNonSimplePredecessor() [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void FinallyWithNonSimplePredecessor() { @@ -773,8 +773,8 @@ public static void FinallyWithNonSimplePredecessor() [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicProperties) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] public static void FinallyInTryWithPredecessor() { @@ -800,17 +800,17 @@ public static void FinallyInTryWithPredecessor() } } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void NestedFinally() { Type t = GetWithPublicMethods(); @@ -839,8 +839,8 @@ public static void NestedFinally() [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicFields) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll4) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void ChangeInFinallyNestedInFinally() { Type t = GetWithPublicMethods(); @@ -863,17 +863,17 @@ public static void ChangeInFinallyNestedInFinally() RequireAll4(t); // fields only } - [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll1) + "(Type)", nameof(GetWithPublicFields) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties) + "()")] [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicProperties) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll3) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void NestedFinallyWithPredecessor() { Type t = GetWithPublicMethods(); @@ -897,9 +897,9 @@ public static void NestedFinallyWithPredecessor() } } - [ExpectedWarning("IL2072", nameof(RequireAllTrue) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAllTrue) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAllTrue) + "(Type)", nameof(GetWithPublicFields) + "()")] - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/117157")] [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicFields) + "()")] public static void ExceptionFilter() { @@ -920,7 +920,7 @@ public static void ExceptionFilter() [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void ExceptionFilterStateChange() { Type t = GetWithPublicMethods(); @@ -963,9 +963,9 @@ public static void ExceptionFilterStateChange() [ExpectedWarning("IL2072", nameof(RequireAll6) + "(Type)", nameof(GetWithPublicProperties) + "()")] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicMethods) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] + [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicFields) + "()", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void ExceptionMultipleFilters() { Type t = GetWithPublicMethods(); @@ -1007,7 +1007,7 @@ public static void ExceptionMultipleFilters() [ExpectedWarning("IL2072", nameof(RequireAll2) + "(Type)", nameof(GetWithPublicProperties))] // Trimmer merges branches going forward. - [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods), Tool.Trimmer | Tool.NativeAot, "")] + [ExpectedWarning("IL2072", nameof(RequireAll) + "(Type)", nameof(GetWithPublicMethods), Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/117157")] public static void ExceptionFilterWithBranch() { Type t = GetWithPublicMethods(); 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 9686a6cc5463a4..badd61dd4b4a0b 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 @@ -99,27 +99,27 @@ class GenericTypeWithRequires< // ArrayValues in the ValueSet for the pattern in this method, hitting the limit. // When this happens, we replace the ValueSet with an unknown value, producing // this warning. - [ExpectedWarning("IL2055", Tool.Analyzer, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "")] + [UnexpectedWarning("IL2055", Tool.Analyzer, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] + [ExpectedWarning("IL2091", "'T'", Tool.Trimmer | Tool.NativeAot, "https://github.com/dotnet/runtime/issues/87596")] public static void Test() { Type[] types = new Type[20] { 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 135c18cb31e2f8..7b5a4c4841310d 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 @@ -66,7 +66,7 @@ static void TestIndirectGuard() // // The analyzer doesn't do constant propagation of the boolean, so it doesn't know that // the return value is always false when TestFeatures.IsUnreferencedCodeSupported is false. - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool AndGuard => TestFeatures.IsUnreferencedCodeSupported && OtherCondition(); @@ -139,7 +139,7 @@ static void TestIsNotFalseGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool IfReturnTrueGuard { @@ -151,7 +151,7 @@ static bool IfReturnTrueGuard } } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool ElseReturnTrueGuard { @@ -208,7 +208,7 @@ static void TestAssertNotReturnFalseGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool AssertReturnTrueGuard { @@ -242,7 +242,7 @@ static void TestThrowGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool TernaryIfGuard => TestFeatures.IsUnreferencedCodeSupported ? true : false; @@ -252,7 +252,7 @@ static void TestTernaryIfGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool TernaryElseGuard => !TestFeatures.IsUnreferencedCodeSupported ? false : true; @@ -289,7 +289,7 @@ public static void Test() class InvalidGuardBodies { - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool ReturnTrueGuard => true; @@ -299,7 +299,7 @@ static void TestReturnTrueGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool OtherConditionGuard => OtherCondition(); @@ -309,7 +309,7 @@ static void TestOtherConditionGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool OrGuard => TestFeatures.IsUnreferencedCodeSupported || OtherCondition(); @@ -319,7 +319,7 @@ static void TestOrGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool NotGuard => !TestFeatures.IsUnreferencedCodeSupported; @@ -329,7 +329,7 @@ static void TestNotGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool EqualsFalseGuard => TestFeatures.IsUnreferencedCodeSupported == false; @@ -339,7 +339,7 @@ static void TestEqualsFalseGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool FalseEqualsGuard => false == TestFeatures.IsUnreferencedCodeSupported; @@ -349,7 +349,7 @@ static void TestFalseEqualsGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool NotEqualsTrueGuard => TestFeatures.IsUnreferencedCodeSupported != true; @@ -359,7 +359,7 @@ static void TestNotEqualsTrueGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool TrueNotEqualsGuard => true != TestFeatures.IsUnreferencedCodeSupported; @@ -369,7 +369,7 @@ static void TestTrueNotEqualsGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool IsNotTrueGuard => TestFeatures.IsUnreferencedCodeSupported is not true; @@ -379,7 +379,7 @@ static void TestIsNotTrueGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool IsFalseGuard => TestFeatures.IsUnreferencedCodeSupported is false; @@ -389,7 +389,7 @@ static void TestIsFalseGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool IfReturnFalseGuard { @@ -407,7 +407,7 @@ static void TestIfReturnFalseGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool ElseReturnFalseGuard { @@ -426,7 +426,7 @@ static void TestElseReturnFalseGuard() RequiresUnreferencedCode(); } - [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "")] + [ExpectedWarning("IL4000", nameof(RequiresUnreferencedCodeAttribute), Tool.Analyzer, "FeatureGuards shouldn't rely on constant propagation.")] [FeatureGuard(typeof(RequiresUnreferencedCodeAttribute))] static bool AssertNotReturnTrueGuard { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MakeGenericDataflowIntrinsics.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MakeGenericDataflowIntrinsics.cs index d6d09828addd7a..a62bae45ae24c0 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MakeGenericDataflowIntrinsics.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/MakeGenericDataflowIntrinsics.cs @@ -38,10 +38,10 @@ public static void Test() public static void TestRecognizedConstraint() => typeof(GenConstrained<>).MakeGenericType(GrabUnknownType()); [ExpectedWarning("IL2055", nameof(Type.MakeGenericType))] - [ExpectedWarning("IL3050", nameof(Type.MakeGenericType), Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(Type.MakeGenericType), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestUnknownOwningType() => GrabUnknownType().MakeGenericType(typeof(object)); - [ExpectedWarning("IL3050", nameof(Type.MakeGenericType), Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(Type.MakeGenericType), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestUnknownArgument() => typeof(Gen<>).MakeGenericType(GrabUnknownType()); } @@ -70,10 +70,10 @@ public static void Test() public static void TestRecognizedConstraint() => typeof(MakeGenericMethod).GetMethod(nameof(GenConstrained)).MakeGenericMethod(GrabUnknownType()); [ExpectedWarning("IL2060", nameof(MethodInfo.MakeGenericMethod))] - [ExpectedWarning("IL3050", nameof(MethodInfo.MakeGenericMethod), Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(MethodInfo.MakeGenericMethod), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestUnknownOwningMethod() => GrabUnknownMethod().MakeGenericMethod(typeof(object)); - [ExpectedWarning("IL3050", nameof(MethodInfo.MakeGenericMethod), Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", nameof(MethodInfo.MakeGenericMethod), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestUnknownArgument() => typeof(MakeGenericMethod).GetMethod(nameof(Gen)).MakeGenericMethod(GrabUnknownType()); } } 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 0819c2c161f045..bd25308b6b9908 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 @@ -870,256 +870,252 @@ public override void Param(Type t) { } public override Type Return() => typeof(int); } - public static void Test() - { - // https://github.com/dotnet/linker/issues/3133 - // Access the interfaces as well - otherwise NativeAOT can decide - // to not look for overrides since it knows it's making a direct access - // to a method and it doesn't need to know about the base method - // which leads to some warnings not being generated. - // The goal of this test is to validate the generated diagnostics - // so we're forcing the checks to happen with this. - typeof(Library.IAnnotatedMethods).RequiresAll(); - typeof(Library.IUnannotatedMethods).RequiresAll(); - - typeof(ImplIUnannotatedMethodsMismatch).RequiresPublicMethods(); - typeof(ImplIAnnotatedMethodsMismatch).RequiresPublicMethods(); - typeof(DerivedFromAnnotatedMismatch).RequiresPublicMethods(); - typeof(DerivedFromUnannotatedMismatch).RequiresPublicMethods(); - typeof(ImplIUnannotatedMethodsMatch).RequiresPublicMethods(); - typeof(ImplIAnnotatedMethodsMatch).RequiresPublicMethods(); - typeof(DerivedFromAnnotatedMatch).RequiresPublicMethods(); - typeof(DerivedFromUnannotatedMatch).RequiresPublicMethods(); - } - } - - // This is mostly for Native AOT - in that compiler it matters how a method - // is referenced as it will take a different code path to do some of these validations - // The above tests all rely on reflection marking so this test also uses direct calls - class DirectCall - { - abstract class Base - { - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public abstract Type NonGenericAbstract([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type); - - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public virtual Type NonGenericVirtual([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => type; - - public abstract void GenericAbstract<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>(); - - public virtual void GenericVirtual<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>() { } - - public abstract Type UnannotatedAbstract(Type type); - - public abstract void UnannotatedGenericAbstract(); - } - - class Derived : Base - { - [ExpectedWarning("IL2092")] - [ExpectedWarning("IL2093")] - public override Type NonGenericAbstract([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type) => null; - - [ExpectedWarning("IL2092")] - [ExpectedWarning("IL2093")] - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] - public override Type NonGenericVirtual(Type type) => null; - - [ExpectedWarning("IL2095")] - public override void GenericAbstract() { } - - [ExpectedWarning("IL2095")] - public override void GenericVirtual<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>() { } - - [ExpectedWarning("IL2092")] - [ExpectedWarning("IL2093")] - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public override Type UnannotatedAbstract([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type) => null; - - [ExpectedWarning("IL2095")] - public override void UnannotatedGenericAbstract<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>() { } - } - - interface IBaseWithDefault - { - void DefaultMethod(Type type); - } - - interface IDerivedWithDefault : IBaseWithDefault - { - [ExpectedWarning("IL2092")] - [UnexpectedWarning("IL2092", Tool.Analyzer, "https://github.com/dotnet/linker/issues/3121")] - void IBaseWithDefault.DefaultMethod([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type) { } - } - - class ImplDerivedWithDefault : IDerivedWithDefault - { - } - - interface IGvmBase - { - Type UnannotatedGvm(Type type); - Type UnannotatedGvmCalledThroughBase(Type type); - - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - static abstract Type AnnotatedStaticGvm<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type); - - static virtual Type UnannotatedStaticGvm(Type type) => null; - } - - 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, "")] - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public Type UnannotatedGvm<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => null; - - [ExpectedWarning("IL2092")] - [ExpectedWarning("IL2093")] - [ExpectedWarning("IL2095")] - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public Type UnannotatedGvmCalledThroughBase<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] T>([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => null; - - [ExpectedWarning("IL2092")] - [ExpectedWarning("IL2093")] - [ExpectedWarning("IL2095")] - public static Type AnnotatedStaticGvm(Type type) => null; - - [ExpectedWarning("IL2092")] - [ExpectedWarning("IL2093")] - [ExpectedWarning("IL2095")] - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public static Type UnannotatedStaticGvm<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] T>([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type) => null; - } - - static void CallStaticGvm() where TGvmBase : IGvmBase - { - TGvmBase.AnnotatedStaticGvm(typeof(string)); - TGvmBase.UnannotatedStaticGvm(typeof(string)); - } - - public static void Test() - { - Base instance = new Derived(); - instance.NonGenericAbstract(typeof(string)); - instance.NonGenericVirtual(typeof(string)); - instance.GenericAbstract(); - instance.GenericVirtual(); - instance.UnannotatedAbstract(typeof(string)); - instance.UnannotatedGenericAbstract(); - - ((IBaseWithDefault)(new ImplDerivedWithDefault())).DefaultMethod(typeof(string)); - - ImplIGvmBase impl = new ImplIGvmBase(); - impl.UnannotatedGvm(typeof(string)); - - IGvmBase ibase = (IGvmBase)impl; - ibase.UnannotatedGvmCalledThroughBase(typeof(string)); - - CallStaticGvm(); - } - } - - class RequiresAndDynamicallyAccessedMembersValidation - { - // These tests have both DynamicallyAccessedMembers annotations and Requires annotations. - // This is to reproduce a bug where the virtual method annotations would be validated due to - // the presence of DynamicallyAccessedMembers, but the logic for checking Requires annotations - // was incorrect. The bug didn't manifest with just Requires annotations because the methods wouldn't - // be validated at all for Requires on type. - - class BaseMethodWithRequires - { - [RequiresUnreferencedCode(nameof(MethodWithRequires))] - [RequiresDynamicCode(nameof(MethodWithRequires))] - public virtual void MethodWithRequires([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type t) { } - } - - [RequiresUnreferencedCode(nameof(DerivedTypeWithRequires_BaseMethodWithRequires))] - [RequiresDynamicCode(nameof(DerivedTypeWithRequires_BaseMethodWithRequires))] - class DerivedTypeWithRequires_BaseMethodWithRequires : BaseMethodWithRequires - { - public override void MethodWithRequires([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type t) { } - } - - [ExpectedWarning("IL2026", nameof(DerivedTypeWithRequires_BaseMethodWithRequires))] - [ExpectedWarning("IL2026", nameof(DerivedTypeWithRequires_BaseMethodWithRequires.MethodWithRequires))] - [ExpectedWarning("IL3050", nameof(DerivedTypeWithRequires_BaseMethodWithRequires), Tool.NativeAot | Tool.Analyzer, "")] - [ExpectedWarning("IL3050", nameof(DerivedTypeWithRequires_BaseMethodWithRequires.MethodWithRequires), Tool.NativeAot | Tool.Analyzer, "")] - static void Test_DerivedTypeWithRequires_BaseMethodWithRequires() - { - new DerivedTypeWithRequires_BaseMethodWithRequires().MethodWithRequires(typeof(int)); - } - - class BaseMethodWithoutRequires - { - public virtual void MethodWithoutRequires([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type t) { } - } - - [RequiresUnreferencedCode(nameof(DerivedTypeWithRequires_BaseMethodWithoutRequires))] - class DerivedTypeWithRequires_BaseMethodWithoutRequires : BaseMethodWithoutRequires - { - public override void MethodWithoutRequires([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type t) { } - } - - [ExpectedWarning("IL2026", nameof(DerivedTypeWithRequires_BaseMethodWithoutRequires))] - static void Test_DerivedTypeWithRequires_BaseMethodWithoutRequires() - { - new DerivedTypeWithRequires_BaseMethodWithoutRequires().MethodWithoutRequires(typeof(int)); - } - - public static void Test() - { - Test_DerivedTypeWithRequires_BaseMethodWithRequires(); - Test_DerivedTypeWithRequires_BaseMethodWithoutRequires(); - } - } - - class InstantiatedGeneric - { - class GenericBase - { - [ExpectedWarning("IL2106")] - [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public virtual T ReturnValue() => default; - } - - class InstantiatedDerived : GenericBase - { - public override Type ReturnValue() => null; - } - - public static void Test() - { - new InstantiatedDerived().ReturnValue(); - } - } - - class AnnotationOnUnsupportedType - { - class UnsupportedType - { - [ExpectedWarning("IL2041")] - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] - public virtual void UnsupportedAnnotationMismatch() { } - } - - class DerivedUnsupportedType : UnsupportedType - { - [ExpectedWarning("IL2041")] - [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] - public override void UnsupportedAnnotationMismatch() { } - } - - public static void Test() - { - new DerivedUnsupportedType().UnsupportedAnnotationMismatch(); - } - } - } + public static void Test () + { + // https://github.com/dotnet/linker/issues/3133 + // Access the interfaces as well - otherwise NativeAOT can decide + // to not look for overrides since it knows it's making a direct access + // to a method and it doesn't need to know about the base method + // which leads to some warnings not being generated. + // The goal of this test is to validate the generated diagnostics + // so we're forcing the checks to happen with this. + typeof (Library.IAnnotatedMethods).RequiresAll (); + typeof (Library.IUnannotatedMethods).RequiresAll (); + + typeof (ImplIUnannotatedMethodsMismatch).RequiresPublicMethods (); + typeof (ImplIAnnotatedMethodsMismatch).RequiresPublicMethods (); + typeof (DerivedFromAnnotatedMismatch).RequiresPublicMethods (); + typeof (DerivedFromUnannotatedMismatch).RequiresPublicMethods (); + typeof (ImplIUnannotatedMethodsMatch).RequiresPublicMethods (); + typeof (ImplIAnnotatedMethodsMatch).RequiresPublicMethods (); + typeof (DerivedFromAnnotatedMatch).RequiresPublicMethods (); + typeof (DerivedFromUnannotatedMatch).RequiresPublicMethods (); + } + } + + // This is mostly for Native AOT - in that compiler it matters how a method + // is referenced as it will take a different code path to do some of these validations + // The above tests all rely on reflection marking so this test also uses direct calls + class DirectCall + { + abstract class Base + { + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public abstract Type NonGenericAbstract ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type); + + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public virtual Type NonGenericVirtual ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => type; + + public abstract void GenericAbstract<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] T> (); + + public virtual void GenericVirtual<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] T> () { } + + public abstract Type UnannotatedAbstract (Type type); + + public abstract void UnannotatedGenericAbstract (); + } + + class Derived : Base + { + [ExpectedWarning ("IL2092")] + [ExpectedWarning ("IL2093")] + public override Type NonGenericAbstract ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] Type type) => null; + + [ExpectedWarning ("IL2092")] + [ExpectedWarning ("IL2093")] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] + public override Type NonGenericVirtual (Type type) => null; + + [ExpectedWarning ("IL2095")] + public override void GenericAbstract () { } + + [ExpectedWarning ("IL2095")] + public override void GenericVirtual<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] T> () { } + + [ExpectedWarning ("IL2092")] + [ExpectedWarning ("IL2093")] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public override Type UnannotatedAbstract ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] Type type) => null; + + [ExpectedWarning ("IL2095")] + public override void UnannotatedGenericAbstract<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] T> () { } + } + + interface IBaseWithDefault + { + void DefaultMethod (Type type); + } + + interface IDerivedWithDefault : IBaseWithDefault + { + [ExpectedWarning ("IL2092")] + [UnexpectedWarning ("IL2092", Tool.Analyzer, "https://github.com/dotnet/linker/issues/3121")] + void IBaseWithDefault.DefaultMethod ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) { } + } + + class ImplDerivedWithDefault : IDerivedWithDefault + { + } + + interface IGvmBase + { + Type UnannotatedGvm (Type type); + Type UnannotatedGvmCalledThroughBase (Type type); + + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + static abstract Type AnnotatedStaticGvm<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] T> ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] Type type); + + static virtual Type UnannotatedStaticGvm (Type type) => null; + } + + 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, "")] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public Type UnannotatedGvm<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] T> ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => null; + + [ExpectedWarning ("IL2092")] + [ExpectedWarning ("IL2093")] + [ExpectedWarning ("IL2095")] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public Type UnannotatedGvmCalledThroughBase<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] T> ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) => null; + + [ExpectedWarning ("IL2092")] + [ExpectedWarning ("IL2093")] + [ExpectedWarning ("IL2095")] + public static Type AnnotatedStaticGvm (Type type) => null; + + [ExpectedWarning ("IL2092")] + [ExpectedWarning ("IL2093")] + [ExpectedWarning ("IL2095")] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public static Type UnannotatedStaticGvm<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] T> ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)] Type type) => null; + } + + static void CallStaticGvm () where TGvmBase : IGvmBase + { + TGvmBase.AnnotatedStaticGvm (typeof (string)); + TGvmBase.UnannotatedStaticGvm (typeof (string)); + } + + public static void Test () + { + Base instance = new Derived (); + instance.NonGenericAbstract (typeof (string)); + instance.NonGenericVirtual (typeof (string)); + instance.GenericAbstract (); + instance.GenericVirtual (); + instance.UnannotatedAbstract (typeof (string)); + instance.UnannotatedGenericAbstract (); + + ((IBaseWithDefault) (new ImplDerivedWithDefault ())).DefaultMethod (typeof (string)); + + ImplIGvmBase impl = new ImplIGvmBase (); + impl.UnannotatedGvm (typeof (string)); + + IGvmBase ibase = (IGvmBase) impl; + ibase.UnannotatedGvmCalledThroughBase (typeof (string)); + + CallStaticGvm (); + } + } + + class RequiresAndDynamicallyAccessedMembersValidation + { + // These tests have both DynamicallyAccessedMembers annotations and Requires annotations. + // This is to reproduce a bug where the virtual method annotations would be validated due to + // the presence of DynamicallyAccessedMembers, but the logic for checking Requires annotations + // was incorrect. The bug didn't manifest with just Requires annotations because the methods wouldn't + // be validated at all for Requires on type. + + class BaseMethodWithRequires + { + [RequiresUnreferencedCode (nameof (MethodWithRequires))] + [RequiresDynamicCode (nameof (MethodWithRequires))] + public virtual void MethodWithRequires ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] Type t) {} + } + + [RequiresUnreferencedCode (nameof (DerivedTypeWithRequires_BaseMethodWithRequires))] + [RequiresDynamicCode (nameof (DerivedTypeWithRequires_BaseMethodWithRequires))] + class DerivedTypeWithRequires_BaseMethodWithRequires : BaseMethodWithRequires + { + public override void MethodWithRequires ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] Type t) {} + } + + [ExpectedWarning ("IL2026", nameof (DerivedTypeWithRequires_BaseMethodWithRequires))] + [ExpectedWarning ("IL2026", nameof (DerivedTypeWithRequires_BaseMethodWithRequires.MethodWithRequires))] + [ExpectedWarning ("IL3050", nameof (DerivedTypeWithRequires_BaseMethodWithRequires), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", nameof (DerivedTypeWithRequires_BaseMethodWithRequires.MethodWithRequires), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + static void Test_DerivedTypeWithRequires_BaseMethodWithRequires () + { + new DerivedTypeWithRequires_BaseMethodWithRequires ().MethodWithRequires (typeof (int)); + } + + class BaseMethodWithoutRequires + { + public virtual void MethodWithoutRequires ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] Type t) {} + } + + [RequiresUnreferencedCode (nameof (DerivedTypeWithRequires_BaseMethodWithoutRequires))] + class DerivedTypeWithRequires_BaseMethodWithoutRequires : BaseMethodWithoutRequires + { + public override void MethodWithoutRequires ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] Type t) {} + } + + [ExpectedWarning ("IL2026", nameof (DerivedTypeWithRequires_BaseMethodWithoutRequires))] + static void Test_DerivedTypeWithRequires_BaseMethodWithoutRequires () + { + new DerivedTypeWithRequires_BaseMethodWithoutRequires ().MethodWithoutRequires (typeof (int)); + } + + public static void Test () + { + Test_DerivedTypeWithRequires_BaseMethodWithRequires (); + Test_DerivedTypeWithRequires_BaseMethodWithoutRequires (); + } + } + + class InstantiatedGeneric + { + class GenericBase { + [ExpectedWarning ("IL2106")] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public virtual T ReturnValue () => default; + } + + class InstantiatedDerived : GenericBase { + public override Type ReturnValue () => null; + } + + public static void Test () + { + new InstantiatedDerived ().ReturnValue (); + } + } + + class AnnotationOnUnsupportedType + { + class UnsupportedType { + [ExpectedWarning ("IL2041")] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] + public virtual void UnsupportedAnnotationMismatch () { } + } + + class DerivedUnsupportedType : UnsupportedType { + [ExpectedWarning ("IL2041")] + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] + public override void UnsupportedAnnotationMismatch () { } + } + + public static void Test () + { + new DerivedUnsupportedType ().UnsupportedAnnotationMismatch (); + } + } + } } namespace System 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 b001fd53afe101..db3e16cdc6ce79 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 @@ -28,8 +28,8 @@ public static void Main() } [ExpectedWarning("IL2026", "Message for --RequiresWithMessageOnly--.")] - [ExpectedWarning("IL3002", "Message for --RequiresWithMessageOnly--.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --RequiresWithMessageOnly--.", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Message for --RequiresWithMessageOnly--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Message for --RequiresWithMessageOnly--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestRequiresWithMessageOnlyOnMethod() { RequiresWithMessageOnly(); @@ -43,8 +43,8 @@ static void RequiresWithMessageOnly() } [ExpectedWarning("IL2026", "Message for --RequiresWithMessageAndUrl--.", "https://helpurl")] - [ExpectedWarning("IL3002", "Message for --RequiresWithMessageAndUrl--.", "https://helpurl", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --RequiresWithMessageAndUrl--.", "https://helpurl", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Message for --RequiresWithMessageAndUrl--.", "https://helpurl", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Message for --RequiresWithMessageAndUrl--.", "https://helpurl", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestRequiresWithMessageAndUrlOnMethod() { RequiresWithMessageAndUrl(); @@ -58,8 +58,8 @@ static void RequiresWithMessageAndUrl() } [ExpectedWarning("IL2026", "Message for --ConstructorRequires--.")] - [ExpectedWarning("IL3002", "Message for --ConstructorRequires--.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --ConstructorRequires--.", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Message for --ConstructorRequires--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Message for --ConstructorRequires--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestRequiresOnConstructor() { new ConstructorRequires(); @@ -77,10 +77,10 @@ public ConstructorRequires() [ExpectedWarning("IL2026", "Message for --getter PropertyRequires--.")] [ExpectedWarning("IL2026", "Message for --setter PropertyRequires--.")] - [ExpectedWarning("IL3002", "Message for --getter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "Message for --setter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --getter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Message for --setter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Message for --getter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3002", "Message for --setter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Message for --getter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Message for --setter PropertyRequires--.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestRequiresOnPropertyGetterAndSetter() { _ = PropertyRequires; @@ -108,8 +108,8 @@ static void WarningMessageWithoutEndingPeriod() } [ExpectedWarning("IL2026", "Adds a trailing period to this message.")] - [ExpectedWarning("IL3002", "Adds a trailing period to this message.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Adds a trailing period to this message.", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Adds a trailing period to this message.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Adds a trailing period to this message.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestThatTrailingPeriodIsAddedToMessage() { WarningMessageWithoutEndingPeriod(); @@ -124,8 +124,8 @@ static void WarningMessageEndsWithPeriod() [LogDoesNotContain("Does not add a period to this message..")] [ExpectedWarning("IL2026", "Does not add a period to this message.")] - [ExpectedWarning("IL3002", "Does not add a period to this message.", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Does not add a period to this message.", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Does not add a period to this message.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Does not add a period to this message.", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestThatTrailingPeriodIsNotDuplicatedInWarningMessage() { WarningMessageEndsWithPeriod(); @@ -191,8 +191,8 @@ public static void GenericTypeWithStaticMethodWhichRequires() { } } [ExpectedWarning("IL2026", "--GenericTypeWithStaticMethodWhichRequires--")] - [ExpectedWarning("IL3002", "--GenericTypeWithStaticMethodWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--GenericTypeWithStaticMethodWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--GenericTypeWithStaticMethodWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--GenericTypeWithStaticMethodWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void GenericTypeWithStaticMethodViaLdftn() { var _ = new Action(GenericWithStaticMethod.GenericTypeWithStaticMethodWhichRequires); @@ -218,8 +218,8 @@ static void Requires() { } [RequiresAssemblyFiles("--PropertyRequires--")] static int PropertyRequires { get; set; } - [ExpectedWarning("IL3002", "--PropertyRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--PropertyRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--PropertyRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3002", "--PropertyRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestProperty() { var a = PropertyRequires; @@ -229,11 +229,11 @@ static void TestProperty() [RequiresAssemblyFiles("--EventRequires--")] static event EventHandler EventRequires; - [ExpectedWarning("IL3002", "--EventRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--EventRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--EventRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3002", "--EventRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [ExpectedWarning("IL2026", "--RequiresOnEventLambda--")] - [ExpectedWarning("IL3002", "--RequiresOnEventLambda--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--RequiresOnEventLambda--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--RequiresOnEventLambda--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--RequiresOnEventLambda--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestEvent() { EventRequires += (object sender, EventArgs e) => throw new NotImplementedException(); @@ -261,7 +261,7 @@ class DynamicCodeOnly [RequiresDynamicCode("--Requires--")] static void Requires() { } - [ExpectedWarning("IL3050", "--Requires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "--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 e20803d6dad011..7e955727d3addf 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 @@ -132,8 +132,8 @@ class NewConstraintTestAnnotatedType [ExpectedWarning("IL2026", "--NewConstraintTestType.ctor--")] [ExpectedWarning("IL2026", "--NewConstraintTestAnnotatedType--")] - [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() where T : new() { GenericMethod(); @@ -152,8 +152,8 @@ public static void DoNothing() { } [ExpectedWarning("IL2026", "--NewConstraintTestType.ctor--")] [ExpectedWarning("IL2026", "--NewConstraintTestAnnotatedType--")] - [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestNewConstraintOnTypeParameter() where T : new() { _ = new NewConstraintOnTypeParameter(); @@ -162,8 +162,8 @@ public static void DoNothing() { } } [ExpectedWarning("IL2026", "--AnnotatedMethod--")] - [ExpectedWarning("IL3002", "--AnnotatedMethod--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AnnotatedMethod--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--AnnotatedMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--AnnotatedMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestNewConstraintOnTypeParameterInAnnotatedMethod() { AnnotatedMethod(); @@ -187,8 +187,8 @@ public static void TestNewConstraintOnTypeParameterInAnnotatedType() [RequiresUnreferencedCode("--AnnotatedType--")] class AnnotatedType { - [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Method() { _ = new NewConstraintOnTypeParameter(); @@ -198,8 +198,8 @@ public static void Method() [ExpectedWarning("IL2026", "--NewConstraintTestType.ctor--")] [ExpectedWarning("IL2026", "--NewConstraintTestAnnotatedType--")] - [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--NewConstraintTestType.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void TestNewConstraintOnTypeParameterOfStaticType() where T : new() { NewConstraintOnTypeParameterOfStaticType.DoNothing(); @@ -223,9 +223,9 @@ static bool PropertyWithLdToken [ExpectedWarning("IL2026", "--PropertyWithLdToken.get--")] [ExpectedWarning("IL2026", "--PropertyWithLdToken.get--", Tool.Trimmer | Tool.NativeAot, "")] - [ExpectedWarning("IL3002", "--PropertyWithLdToken.get--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--PropertyWithLdToken.get--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [ExpectedWarning("IL3002", "--PropertyWithLdToken.get--", Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--PropertyWithLdToken.get--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "--PropertyWithLdToken.get--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [ExpectedWarning("IL3050", "--PropertyWithLdToken.get--", Tool.NativeAot, "")] static void TestPropertyLdToken() { @@ -240,8 +240,8 @@ static void MethodWithLdToken() } [ExpectedWarning("IL2026", "--MethodWithLdToken--")] - [ExpectedWarning("IL3002", "--MethodWithLdToken--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithLdToken--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithLdToken--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithLdToken--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestMethodLdToken() { Expression e = () => MethodWithLdToken(); @@ -255,7 +255,7 @@ class FieldWithLdTokenType } [ExpectedWarning("IL2026", "--FieldWithLdToken--")] - [ExpectedWarning("IL3050", "--FieldWithLdToken--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "--FieldWithLdToken--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestFieldLdToken() { Expression> f = () => FieldWithLdTokenType.Field; @@ -279,16 +279,16 @@ static void MethodWithDelegate() } [ExpectedWarning("IL2026", "--MethodWithDelegate--")] - [ExpectedWarning("IL3002", "--MethodWithDelegate--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithDelegate--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithDelegate--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithDelegate--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestMethodWithDelegate() { Action a = MethodWithDelegate; } [ExpectedWarning("IL2026", "--LambdaThroughDelegate--")] - [ExpectedWarning("IL3002", "--LambdaThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--LambdaThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--LambdaThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--LambdaThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void LambdaThroughDelegate() { Action a = @@ -302,8 +302,8 @@ static void LambdaThroughDelegate() } [ExpectedWarning("IL2026", "--LocalFunctionThroughDelegate--")] - [ExpectedWarning("IL3002", "--LocalFunctionThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--LocalFunctionThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--LocalFunctionThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--LocalFunctionThroughDelegate--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void LocalFunctionThroughDelegate() { Action a = Local; 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 ad5ef330cc0e12..b7c626f55be8d3 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 @@ -176,8 +176,8 @@ class DerivedClassWithRequires : BaseClassWithoutRequires [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] [ExpectedWarning("IL2046", "DerivedClassWithRequires.VirtualMethod()", "BaseClassWithoutRequires.VirtualMethod()")] - [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualMethod()", "BaseClassWithoutRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "DerivedClassWithRequires.VirtualMethod()", "BaseClassWithoutRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualMethod()", "BaseClassWithoutRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "DerivedClassWithRequires.VirtualMethod()", "BaseClassWithoutRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public override void VirtualMethod() { } @@ -186,8 +186,8 @@ public override void VirtualMethod() public override string VirtualPropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "DerivedClassWithRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message")] [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] @@ -198,9 +198,9 @@ public override string VirtualPropertyAnnotationInAccesor [RequiresAssemblyFiles("Message")] public override string VirtualPropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithoutRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithoutRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithoutRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithoutRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -243,8 +243,8 @@ public static void Test() class DerivedClassWithoutRequires : BaseClassWithRequires { [ExpectedWarning("IL2046", "DerivedClassWithoutRequires.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()")] - [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "DerivedClassWithoutRequires.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "DerivedClassWithoutRequires.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public override void VirtualMethod() { } @@ -253,26 +253,26 @@ public override void VirtualMethod() public override string VirtualPropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get { return name; } set { name = value; } } public override string VirtualPropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInProperty", "BaseClassWithRequires.VirtualPropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } public override string VirtualPropertyAnnotationInPropertyAndAccessor { [ExpectedWarning("IL2046", "VirtualPropertyAnnotationInPropertyAndAccessor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInPropertyAndAccessor", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithoutRequires.VirtualPropertyAnnotationInPropertyAndAccessor", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -280,8 +280,8 @@ public override string VirtualPropertyAnnotationInPropertyAndAccessor class DerivedClassWithAllWarnings : BaseClassWithRequires { [ExpectedWarning("IL2046", "DerivedClassWithAllWarnings.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()")] - [ExpectedWarning("IL3003", "DerivedClassWithAllWarnings.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "DerivedClassWithAllWarnings.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithAllWarnings.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "DerivedClassWithAllWarnings.VirtualMethod()", "BaseClassWithRequires.VirtualMethod()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public override void VirtualMethod() { } @@ -292,12 +292,12 @@ public override void VirtualMethod() public override string VirtualPropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3051", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3051", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get { return name; } [RequiresAssemblyFiles("Message")] [RequiresUnreferencedCode("Message")] [ExpectedWarning("IL2046", "VirtualPropertyAnnotationInAccesor.set", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.set")] - [ExpectedWarning("IL3003", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.set", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.set", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInAccesor.set", "BaseClassWithRequires.VirtualPropertyAnnotationInAccesor.set", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set { name = value; } } @@ -316,7 +316,7 @@ public override string VirtualPropertyAnnotationInProperty public override string VirtualPropertyAnnotationInPropertyAndAccessor { [ExpectedWarning("IL2046", "VirtualPropertyAnnotationInPropertyAndAccessor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3003", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInPropertyAndAccessor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "DerivedClassWithAllWarnings.VirtualPropertyAnnotationInPropertyAndAccessor.get", "BaseClassWithRequires.VirtualPropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; [RequiresAssemblyFiles("Message")] [RequiresUnreferencedCode("Message")] @@ -371,8 +371,8 @@ class ImplementationClassWithRequires : IBaseWithoutRequires [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] [ExpectedWarning("IL2046", "ImplementationClassWithRequires.Method()", "IBaseWithoutRequires.Method()")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithRequires.Method()", "IBaseWithoutRequires.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public void Method() { } @@ -381,8 +381,8 @@ public void Method() public string PropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithRequires.PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message")] [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] @@ -394,9 +394,9 @@ public string PropertyAnnotationInAccesor [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] public string PropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.NativeAot | Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.NativeAot | Tool.Analyzer, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } @@ -407,9 +407,9 @@ public string PropertyAnnotationInPropertyAndAccessor [RequiresAssemblyFiles("Message")] [RequiresUnreferencedCode("Message")] [ExpectedWarning("IL2046", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -434,8 +434,8 @@ void IBaseWithoutRequires.Method() string IBaseWithoutRequires.PropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "PropertyAnnotationInAccesor.get", "IBaseWithoutRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message")] [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] @@ -447,9 +447,9 @@ string IBaseWithoutRequires.PropertyAnnotationInAccesor [ExpectedWarning("IL3003", "ExplicitImplementationClassWithRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] string IBaseWithoutRequires.PropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithoutRequires.PropertyAnnotationInProperty", "IBaseWithoutRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } @@ -460,9 +460,9 @@ string IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor [RequiresAssemblyFiles("Message")] [RequiresUnreferencedCode("Message")] [ExpectedWarning("IL2046", "PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get")] - [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor", "IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -470,8 +470,8 @@ string IBaseWithoutRequires.PropertyAnnotationInPropertyAndAccessor class ImplementationClassWithoutRequires : IBaseWithRequires { [ExpectedWarning("IL2046", "ImplementationClassWithoutRequires.Method()", "IBaseWithRequires.Method()")] - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.Method()", "IBaseWithRequires.Method()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithoutRequires.Method()", "IBaseWithRequires.Method()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.Method()", "IBaseWithRequires.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithoutRequires.Method()", "IBaseWithRequires.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public void Method() { } @@ -480,8 +480,8 @@ public void Method() public string PropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "ImplementationClassWithoutRequires.PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithoutRequires.PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithoutRequires.PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get { return name; } set { name = value; } } @@ -489,9 +489,9 @@ public string PropertyAnnotationInAccesor [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] public string PropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } @@ -503,7 +503,7 @@ public string PropertyAnnotationInPropertyAndAccessor [ExpectedWarning("IL2046", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.get", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.get")] get; [ExpectedWarning("IL2046", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.set", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set")] - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.set", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequires.PropertyAnnotationInPropertyAndAccessor.set", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -525,8 +525,8 @@ void IBaseWithRequires.Method() string IBaseWithRequires.PropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "PropertyAnnotationInAccesor.get", "IBaseWithRequires.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get { return name; } set { name = value; } } @@ -534,19 +534,19 @@ string IBaseWithRequires.PropertyAnnotationInAccesor [ExpectedWarning("IL3003", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer, "")] string IBaseWithRequires.PropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInProperty", "IBaseWithRequires.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } [ExpectedWarning("IL3003", "ExplicitImplementationClassWithoutRequires.Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer, "")] string IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor { - [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "Mono.Linker.Tests.Cases.RequiresCapability.RequiresAttributeMismatch.IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; [ExpectedWarning("IL2046", "PropertyAnnotationInPropertyAndAccessor.set", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set")] - [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor.set", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "PropertyAnnotationInPropertyAndAccessor.set", "IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor.set", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -554,8 +554,8 @@ string IBaseWithRequires.PropertyAnnotationInPropertyAndAccessor class ImplementationClassWithoutRequiresInSource : ReferenceInterfaces.IBaseWithRequiresInReference { [ExpectedWarning("IL2046", "ImplementationClassWithoutRequiresInSource.Method()", "IBaseWithRequiresInReference.Method()")] - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.Method()", "IBaseWithRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithoutRequiresInSource.Method()", "IBaseWithRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.Method()", "IBaseWithRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithoutRequiresInSource.Method()", "IBaseWithRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public void Method() { } @@ -564,8 +564,8 @@ public void Method() public string PropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithRequiresInReference.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get { return name; } set { name = value; } } @@ -573,9 +573,9 @@ public string PropertyAnnotationInAccesor [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty", "IBaseWithRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer, "")] public string PropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty.get", "IBaseWithRequiresInReference.PropertyAnnotationInProperty.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty.get", "IBaseWithRequiresInReference.PropertyAnnotationInProperty.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty.set", "IBaseWithRequiresInReference.PropertyAnnotationInProperty.set", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithoutRequiresInSource.PropertyAnnotationInProperty.set", "IBaseWithRequiresInReference.PropertyAnnotationInProperty.set", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -583,8 +583,8 @@ public string PropertyAnnotationInProperty class ImplementationClassWithRequiresInSource : ReferenceInterfaces.IBaseWithoutRequiresInReference { [ExpectedWarning("IL2046", "ImplementationClassWithRequiresInSource.Method()", "IBaseWithoutRequiresInReference.Method()")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.Method()", "IBaseWithoutRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithRequiresInSource.Method()", "IBaseWithoutRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.Method()", "IBaseWithoutRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithRequiresInSource.Method()", "IBaseWithoutRequiresInReference.Method()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message")] [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] @@ -596,8 +596,8 @@ public void Method() public string PropertyAnnotationInAccesor { [ExpectedWarning("IL2046", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithoutRequiresInReference.PropertyAnnotationInAccesor.get")] - [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithoutRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithoutRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithoutRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplementationClassWithRequiresInSource.PropertyAnnotationInAccesor.get", "IBaseWithoutRequiresInReference.PropertyAnnotationInAccesor.get", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message")] [RequiresAssemblyFiles("Message")] [RequiresDynamicCode("Message")] @@ -609,9 +609,9 @@ public string PropertyAnnotationInAccesor [RequiresAssemblyFiles("Message")] public string PropertyAnnotationInProperty { - [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty", "IBaseWithoutRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty", "IBaseWithoutRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] get; - [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty", "IBaseWithoutRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplementationClassWithRequiresInSource.PropertyAnnotationInProperty", "IBaseWithoutRequiresInReference.PropertyAnnotationInProperty", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] set; } } @@ -680,13 +680,13 @@ public static void AbstractMethod() { } class ImplIRequiresMismatching : IRequires { [ExpectedWarning("IL2046", "ImplIRequiresMismatching.VirtualMethod", "IRequires.VirtualMethod")] - [ExpectedWarning("IL3003", "ImplIRequiresMismatching.VirtualMethod", "IRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplIRequiresMismatching.VirtualMethod", "IRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplIRequiresMismatching.VirtualMethod", "IRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplIRequiresMismatching.VirtualMethod", "IRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void VirtualMethod() { } [ExpectedWarning("IL2046", "ImplIRequiresMismatching.AbstractMethod", "IRequires.AbstractMethod")] - [ExpectedWarning("IL3003", "ImplIRequiresMismatching.AbstractMethod", "IRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplIRequiresMismatching.AbstractMethod", "IRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplIRequiresMismatching.AbstractMethod", "IRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplIRequiresMismatching.AbstractMethod", "IRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void AbstractMethod() { } } class ImplINoRequiresMatching : INoRequires @@ -699,16 +699,16 @@ public static void AbstractMethod() { } class ImplINoRequiresMismatching : INoRequires { [ExpectedWarning("IL2046", "ImplINoRequiresMismatching.VirtualMethod", "INoRequires.VirtualMethod")] - [ExpectedWarning("IL3003", "ImplINoRequiresMismatching.VirtualMethod", "INoRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplINoRequiresMismatching.VirtualMethod", "INoRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplINoRequiresMismatching.VirtualMethod", "INoRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplINoRequiresMismatching.VirtualMethod", "INoRequires.VirtualMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message for --StaticInterfaceMethods.ImplINoRequiresMatching.VirtualMethod--")] [RequiresAssemblyFiles("Message for --StaticInterfaceMethods.ImplINoRequiresMatching.VirtualMethod--")] [RequiresDynamicCode("Message for --StaticInterfaceMethods.ImplINoRequiresMatching.VirtualMethod--")] public static void VirtualMethod() { } [ExpectedWarning("IL2046", "ImplINoRequiresMismatching.AbstractMethod", "INoRequires.AbstractMethod")] - [ExpectedWarning("IL3003", "ImplINoRequiresMismatching.AbstractMethod", "INoRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3051", "ImplINoRequiresMismatching.AbstractMethod", "INoRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3003", "ImplINoRequiresMismatching.AbstractMethod", "INoRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3051", "ImplINoRequiresMismatching.AbstractMethod", "INoRequires.AbstractMethod", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message for --StaticInterfaceMethods.ImplINoRequiresMatching.AbstractMethod--")] [RequiresAssemblyFiles("Message for --StaticInterfaceMethods.ImplINoRequiresMatching.AbstractMethod--")] [RequiresDynamicCode("Message for --StaticInterfaceMethods.ImplINoRequiresMatching.AbstractMethod--")] 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 47bb60d43babdd..867647ae550d82 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 @@ -52,8 +52,8 @@ public static void Main() class WarnInIteratorBody { [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] static IEnumerable TestCallBeforeYieldReturn() { MethodWithRequires(); @@ -61,8 +61,8 @@ static IEnumerable TestCallBeforeYieldReturn() } [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] static IEnumerable TestCallAfterYieldReturn() { yield return 0; @@ -100,8 +100,8 @@ static IEnumerable TestLdftn() // Cannot annotate fields either with RUC nor RAF therefore the warning persists [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static IEnumerable TestLazyDelegate() @@ -169,8 +169,8 @@ static IEnumerable TestLdftn() // Cannot annotate fields either with RUC nor RAF therefore the warning persists [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static IEnumerable TestLazyDelegate() @@ -236,8 +236,8 @@ public static void Test() class WarnInAsyncBody { [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] static async void TestCallBeforeYieldReturn() { MethodWithRequires(); @@ -245,8 +245,8 @@ static async void TestCallBeforeYieldReturn() } [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] static async void TestCallAfterYieldReturn() { await MethodAsync(); @@ -280,8 +280,8 @@ static async void TestLdftn() } [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static async void TestLazyDelegate() @@ -346,8 +346,8 @@ static async void TestLdftn() // Cannot annotate fields either with RUC nor RAF therefore the warning persists [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static async void TestLazyDelegate() @@ -411,8 +411,8 @@ public static void Test() class WarnInAsyncIteratorBody { [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] static async IAsyncEnumerable TestCallBeforeYieldReturn() { await MethodAsync(); @@ -421,8 +421,8 @@ static async IAsyncEnumerable TestCallBeforeYieldReturn() } [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] static async IAsyncEnumerable TestCallAfterYieldReturn() { yield return 0; @@ -460,8 +460,8 @@ static async IAsyncEnumerable TestLdftn() } [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static async IAsyncEnumerable TestLazyDelegate() @@ -532,8 +532,8 @@ static async IAsyncEnumerable TestLdftn() // Cannot annotate fields either with RUC nor RAF therefore the warning persists [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static async IAsyncEnumerable TestLazyDelegate() @@ -606,14 +606,14 @@ static void TestCall() LocalFunction(); [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] void LocalFunction() => MethodWithRequires(); } [ExpectedWarning("IL2026", "--LocalFunctionWithRequires--")] - [ExpectedWarning("IL3002", "--LocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--LocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--LocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--LocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLocalFunctionWithRequires() { LocalFunction(); @@ -635,8 +635,8 @@ static void TestCallWithClosure(int p = 0) LocalFunction(); [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] void LocalFunction() { p++; @@ -685,8 +685,8 @@ void LocalFunction() } [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static void TestLazyDelegate() @@ -790,8 +790,8 @@ void LocalFunction() } [ExpectedWarning("IL2026", "Message from --MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "Message from --MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static void TestLazyDelegate() @@ -1029,8 +1029,8 @@ void LocalFunction(Type unknownType = null) class TestSuppressionOnOuterWithSameName { [ExpectedWarning("IL2026", nameof(Outer) + "()")] - [ExpectedWarning("IL3002", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { Outer(); @@ -1094,14 +1094,14 @@ static void WarnInNonNestedLocalFunctionTest() LocalFunction(); [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void LocalFunction() => MethodWithRequires(); } [ExpectedWarning("IL2026", "--MethodWithNonNestedLocalFunction--")] - [ExpectedWarning("IL3002", "--MethodWithNonNestedLocalFunction--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithNonNestedLocalFunction--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithNonNestedLocalFunction--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithNonNestedLocalFunction--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void SuppressInNonNestedLocalFunctionTest() { MethodWithNonNestedLocalFunction(); @@ -1123,16 +1123,16 @@ static void TestCall() { Action lambda = [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] () => MethodWithRequires(); lambda(); } [ExpectedWarning("IL2026", "--LambdaWithRequires--")] - [ExpectedWarning("IL3002", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLambdaWithRequires() { Action lambda = @@ -1148,14 +1148,14 @@ static void TestCallUnused() { Action _ = [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] () => MethodWithRequires(); } [ExpectedWarning("IL2026", "--LambdaWithRequires--")] - [ExpectedWarning("IL3002", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--LambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLambdaWithRequiresUnused() { Action _ = @@ -1169,8 +1169,8 @@ static void TestCallWithClosure(int p = 0) { Action lambda = [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] () => { p++; @@ -1230,8 +1230,8 @@ static void TestLdftn() } [ExpectedWarning("IL2026", "--MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static void TestLazyDelegate() @@ -1341,8 +1341,8 @@ static void TestLdftn() } [ExpectedWarning("IL2026", "--MethodWithRequiresAndReturns--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequiresAndReturns--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] public static Lazy _default = new Lazy(MethodWithRequiresAndReturns); static void TestLazyDelegate() @@ -1457,8 +1457,8 @@ static void TestSuppressionOnOuterAndLambda() class TestSuppressionOnOuterWithSameName { [ExpectedWarning("IL2026", nameof(Outer) + "()")] - [ExpectedWarning("IL3002", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", nameof(Outer) + "()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { Outer(); @@ -1520,8 +1520,8 @@ static async void TestIteratorLocalFunctionInAsync() await MethodAsync(); [ExpectedWarning("IL2026", "--MethodWithRequires--", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning", CompilerGeneratedCode = true)] IEnumerable LocalFunction() { yield return 0; @@ -1560,8 +1560,8 @@ IEnumerable IteratorLocalFunction() yield return 1; [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] void LocalFunction() => MethodWithRequires(); } } @@ -1578,8 +1578,8 @@ IEnumerable IteratorLocalFunction() } [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] void LocalFunction() => MethodWithRequires(); } @@ -1774,8 +1774,8 @@ static IEnumerable TestDynamicallyAccessedMethodViaGenericMethodParameterIn #endif [ExpectedWarning("IL2026", "--IteratorLocalFunction--")] - [ExpectedWarning("IL3002", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLocalFunctionInIteratorLocalFunction() { IteratorLocalFunction(); @@ -1799,8 +1799,8 @@ IEnumerable IteratorLocalFunction() } [ExpectedWarning("IL2026", "--IteratorLocalFunction--")] - [ExpectedWarning("IL3002", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--IteratorLocalFunction--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLocalFunctionCalledFromIteratorLocalFunctionAndMethod() { IteratorLocalFunction(); @@ -1818,8 +1818,8 @@ IEnumerable IteratorLocalFunction() } [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] void LocalFunction() => MethodWithRequires(); } @@ -1917,8 +1917,8 @@ public static void Test() class LocalFunctionsReferencedViaReflection { [ExpectedWarning("IL2026", "--TestLocalFunctionWithRequires--")] - [ExpectedWarning("IL3002", "--TestLocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--TestLocalFunctionWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLocalFunctionWithRequires() { LocalFunction(); @@ -1938,8 +1938,8 @@ static void TestLocalFunctionWithRequiresOnlyAccessedViaReflection() } [ExpectedWarning("IL2026", "LocalFunction")] - [ExpectedWarning("IL3002", "LocalFunction", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "LocalFunction", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "LocalFunction", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "LocalFunction", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLocalFunctionWithClosureWithRequires(int p = 0) { LocalFunction(); @@ -2028,8 +2028,8 @@ public static void Test() class LambdasReferencedViaReflection { [ExpectedWarning("IL2026", "--TestLambdaWithRequires--")] - [ExpectedWarning("IL3002", "--TestLambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--TestLambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--TestLambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--TestLambdaWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLambdaWithRequires() { var lambda = @@ -2042,8 +2042,8 @@ static void TestLambdaWithRequires() } [ExpectedWarning("IL2026", "Lambda")] - [ExpectedWarning("IL3002", "Lambda", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "Lambda", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "Lambda", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "Lambda", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestLambdaWithClosureWithRequires(int p = 0) { var lambda = @@ -2138,8 +2138,8 @@ static async Task AsyncMethodCallingRequires(Type type) } [ExpectedWarning("IL2026", "ParentSuppression")] - [ExpectedWarning("IL3002", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { AsyncMethodCallingRequires(typeof(object)); @@ -2168,8 +2168,8 @@ static async Task AsyncMethodCallingRequires() } [ExpectedWarning("IL2026", "ParentSuppression")] - [ExpectedWarning("IL3002", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { AsyncMethodCallingRequires(); @@ -2208,8 +2208,8 @@ static async IAsyncEnumerable CreateAsync() } [ExpectedWarning("IL2026", "ParentSuppression")] - [ExpectedWarning("IL3002", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "ParentSuppression", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { AsyncEnumMethodCallingRequires(); 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 560f654de6f2b2..e91f18174b32f0 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 @@ -64,18 +64,18 @@ public bool PropertyWhichRequires } } - [ExpectedWarning("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - class GenericTypeWithAttributedParameter<[AttributeWhichRequires] T> - { - public static void TestMethod() { } - } - - [ExpectedWarning("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - static void GenericMethodWithAttributedParameter<[AttributeWhichRequires] T>() { } + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + class GenericTypeWithAttributedParameter<[AttributeWhichRequires] T> + { + public static void TestMethod () { } + } + + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + static void GenericMethodWithAttributedParameter<[AttributeWhichRequires] T> () { } static void TestRequiresOnAttributeOnGenericParameter() { @@ -83,47 +83,47 @@ static void TestRequiresOnAttributeOnGenericParameter() GenericMethodWithAttributedParameter(); } - [ExpectedWarning("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [AttributeWhichRequires] - [AttributeWhichRequiresOnProperty(PropertyWhichRequires = true)] - class TypeWithAttributeWhichRequires - { - } - - [ExpectedWarning("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [AttributeWhichRequires] - [AttributeWhichRequiresOnProperty(PropertyWhichRequires = true)] - static void MethodWithAttributeWhichRequires() { } - - [ExpectedWarning("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [AttributeWhichRequires] - [AttributeWhichRequiresOnProperty(PropertyWhichRequires = true)] - static int _fieldWithAttributeWhichRequires; - - [ExpectedWarning("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] - [ExpectedWarning("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [AttributeWhichRequires] - [AttributeWhichRequiresOnProperty(PropertyWhichRequires = true)] - static bool PropertyWithAttributeWhichRequires { get; set; } + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [AttributeWhichRequires] + [AttributeWhichRequiresOnProperty (PropertyWhichRequires = true)] + class TypeWithAttributeWhichRequires + { + } + + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [AttributeWhichRequires] + [AttributeWhichRequiresOnProperty (PropertyWhichRequires = true)] + static void MethodWithAttributeWhichRequires () { } + + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [AttributeWhichRequires] + [AttributeWhichRequiresOnProperty (PropertyWhichRequires = true)] + static int _fieldWithAttributeWhichRequires; + + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresAttribute.ctor--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresAttribute.ctor--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL2026", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--")] + [ExpectedWarning ("IL3002", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--AttributeWhichRequiresOnPropertyAttribute.PropertyWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [AttributeWhichRequires] + [AttributeWhichRequiresOnProperty (PropertyWhichRequires = true)] + static bool PropertyWithAttributeWhichRequires { get; set; } [AttributeWhichRequires] [AttributeWhichRequiresOnProperty(PropertyWhichRequires = true)] @@ -132,13 +132,13 @@ static void MethodWithAttributeWhichRequires() { } [RequiresDynamicCode("--MethodWhichRequiresWithAttributeWhichRequires--")] static void MethodWhichRequiresWithAttributeWhichRequires() { } - [ExpectedWarning("IL2026", "--MethodWhichRequiresWithAttributeWhichRequires--")] - [ExpectedWarning("IL3002", "--MethodWhichRequiresWithAttributeWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWhichRequiresWithAttributeWhichRequires--", Tool.Analyzer | Tool.NativeAot, "")] - static void TestMethodWhichRequiresWithAttributeWhichRequires() - { - MethodWhichRequiresWithAttributeWhichRequires(); - } + [ExpectedWarning ("IL2026", "--MethodWhichRequiresWithAttributeWhichRequires--")] + [ExpectedWarning ("IL3002", "--MethodWhichRequiresWithAttributeWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning ("IL3050", "--MethodWhichRequiresWithAttributeWhichRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + static void TestMethodWhichRequiresWithAttributeWhichRequires () + { + MethodWhichRequiresWithAttributeWhichRequires (); + } class RequiresTriggeredByAttributeUsage { 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 059b06ae3662a2..d7aeb8c85c57e7 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 @@ -822,7 +822,7 @@ static void TestDAMAccessOnInstantiatedGeneric() [ExpectedWarning("IL2026", "--TestDAMOnTypeAccessInRUCScope--")] [ExpectedWarning("IL2026", "DAMAnnotatedClass.DAMAnnotatedClass()")] - [ExpectedWarning("IL3050", "DAMAnnotatedClass.DAMAnnotatedClass()", Tool.NativeAot | Tool.Analyzer, "")] + [ExpectedWarning("IL3050", "DAMAnnotatedClass.DAMAnnotatedClass()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { TestDAMAccess(); @@ -1213,7 +1213,7 @@ static void TestDAMOnTypeAccess(DAMAnnotatedClass instance) } [ExpectedWarning("IL2026", "DAMAnnotatedClass.DAMAnnotatedClass()")] - [ExpectedWarning("IL3050", "DAMAnnotatedClass.DAMAnnotatedClass()", Tool.NativeAot | Tool.Analyzer, "")] + [ExpectedWarning("IL3050", "DAMAnnotatedClass.DAMAnnotatedClass()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { TestDAMAccess(); @@ -1241,7 +1241,7 @@ public int PropertyOnAttribute [AttributeWithRequires(PropertyOnAttribute = 42)] [ExpectedWarning("IL2026", "AttributeWithRequires.AttributeWithRequires()")] - [ExpectedWarning("IL3050", "AttributeWithRequires.AttributeWithRequires()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "AttributeWithRequires.AttributeWithRequires()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void KeepFieldOnAttributeInner() { } static void KeepFieldOnAttribute() @@ -1440,7 +1440,7 @@ public static void Method() { } } [ExpectedWarning("IL2026", "--ConstClassWithRequires--", nameof(ConstClassWithRequires.Method))] - [ExpectedWarning("IL3050", "--ConstClassWithRequires--", nameof(ConstClassWithRequires.Method), Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "--ConstClassWithRequires--", nameof(ConstClassWithRequires.Method), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestClassWithRequires() { var a = ConstClassWithRequires.Message; @@ -1459,7 +1459,7 @@ public static void Method() { } } [ExpectedWarning("IL2026", "--ConstClassWithRequiresUsingField--", nameof(ConstClassWithRequiresUsingField.Method))] - [ExpectedWarning("IL3050", "--ConstClassWithRequiresUsingField--", nameof(ConstClassWithRequiresUsingField.Method), Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3050", "--ConstClassWithRequiresUsingField--", nameof(ConstClassWithRequiresUsingField.Method), Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestClassUsingFieldInAttribute() { ConstClassWithRequiresUsingField.Method(); 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 6fedf2c4f4d01b..6a8df3d20a05dc 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 @@ -30,8 +30,8 @@ public static void Main() class StaticCtor { [ExpectedWarning("IL2026", "--MethodWithRequires--")] - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [ExpectedWarning("IL2116", "StaticCtor..cctor()")] [RequiresUnreferencedCode("Message for --TestStaticCtor--")] static StaticCtor() @@ -48,8 +48,8 @@ static void TestStaticCctorRequires() [RequiresUnreferencedCode("Message for --StaticCtorOnTypeWithRequires--")] class StaticCtorOnTypeWithRequires { - [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static StaticCtorOnTypeWithRequires() => MethodWithRequires(); } @@ -118,8 +118,8 @@ static void TestStaticCtorMarkingIsTriggeredByFieldAccessOnExplicitLayout() class StaticCtorTriggeredByMethodCall { [ExpectedWarning("IL2116", "StaticCtorTriggeredByMethodCall..cctor()")] - [ExpectedWarning("IL3004", "StaticCtorTriggeredByMethodCall..cctor()", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3056", "StaticCtorTriggeredByMethodCall..cctor()", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3004", "StaticCtorTriggeredByMethodCall..cctor()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3056", "StaticCtorTriggeredByMethodCall..cctor()", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [RequiresUnreferencedCode("Message for --StaticCtorTriggeredByMethodCall.Cctor--")] [RequiresAssemblyFiles("Message for --StaticCtorTriggeredByMethodCall.Cctor--")] [RequiresDynamicCode("Message for --StaticCtorTriggeredByMethodCall.Cctor--")] @@ -137,8 +137,8 @@ public void TriggerStaticCtorMarking() [ExpectedWarning("IL2026", "--StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--")] - [ExpectedWarning("IL3002", "--StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestStaticCtorTriggeredByMethodCall() { new StaticCtorTriggeredByMethodCall().TriggerStaticCtorMarking(); 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 7dcb7574d2c4a6..029c062a3f6e33 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 @@ -46,8 +46,8 @@ public override void VirtualMethodRequires() } [ExpectedWarning("IL2026", "--BaseType.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestCallOnBase() { var tmp = new BaseType(); @@ -55,8 +55,8 @@ static void TestCallOnBase() } [ExpectedWarning("IL2026", "--BaseType.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestCallOnOverride() { var tmp = new TypeWhichOverridesMethod(); @@ -64,8 +64,8 @@ static void TestCallOnOverride() } [ExpectedWarning("IL2026", "--BaseType.VirtualMethodRequires--")] - [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--BaseType.VirtualMethodRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestCallOnOverrideViaBase() { BaseType tmp = new TypeWhichOverridesMethod(); @@ -135,8 +135,8 @@ public override int VirtualPropertyRequires } [ExpectedWarning("IL2026", "--PropertyBaseType.VirtualPropertyRequires--")] - [ExpectedWarning("IL3002", "--PropertyBaseType.VirtualPropertyRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--PropertyBaseType.VirtualPropertyRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--PropertyBaseType.VirtualPropertyRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--PropertyBaseType.VirtualPropertyRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void CallOnDerived() { var tmp = new TypeWhichOverridesProperty(); @@ -173,8 +173,8 @@ public void MethodWithRequires() } [ExpectedWarning("IL2026", "--IRequires.MethodWithRequires--")] - [ExpectedWarning("IL3002", "--IRequires.MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--IRequires.MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--IRequires.MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--IRequires.MethodWithRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestCallViaInterface() { IRequires inst = new ImplementationClass(); @@ -182,8 +182,8 @@ static void TestCallViaInterface() } [ExpectedWarning("IL2026", "--ImplementationClass.RequiresMethod--")] - [ExpectedWarning("IL3002", "--ImplementationClass.RequiresMethod--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--ImplementationClass.RequiresMethod--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--ImplementationClass.RequiresMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--ImplementationClass.RequiresMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestCallViaImplementationClass() { ImplementationClass inst = new ImplementationClass(); @@ -242,8 +242,8 @@ public override DerivedReturnType GetRequires() } [ExpectedWarning("IL2026", "--CovariantReturnDerived.GetRequires--")] - [ExpectedWarning("IL3002", "--CovariantReturnDerived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--CovariantReturnDerived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--CovariantReturnDerived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--CovariantReturnDerived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void CallOnDerived() { var tmp = new CovariantReturnDerived(); @@ -278,8 +278,8 @@ public override DerivedReturnType GetRequires() } [ExpectedWarning("IL2026", "--CovariantReturnViaLdftn.Derived.GetRequires--")] - [ExpectedWarning("IL3002", "--CovariantReturnViaLdftn.Derived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--CovariantReturnViaLdftn.Derived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--CovariantReturnViaLdftn.Derived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--CovariantReturnViaLdftn.Derived.GetRequires--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] public static void Test() { var tmp = new Derived(); @@ -345,11 +345,11 @@ public static void AbstractMethod() { } } [ExpectedWarning("IL2026", "--StaticInterfaces.IRequires.VirtualMethod--")] - [ExpectedWarning("IL3002", "--StaticInterfaces.IRequires.VirtualMethod--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--StaticInterfaces.IRequires.VirtualMethod--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--StaticInterfaces.IRequires.VirtualMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--StaticInterfaces.IRequires.VirtualMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] [ExpectedWarning("IL2026", "--StaticInterfaces.IRequires.AbstractMethod--")] - [ExpectedWarning("IL3002", "--StaticInterfaces.IRequires.AbstractMethod--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--StaticInterfaces.IRequires.AbstractMethod--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--StaticInterfaces.IRequires.AbstractMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--StaticInterfaces.IRequires.AbstractMethod--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void UseRequiresMethods() where T : IRequires { T.AbstractMethod(); 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 059566de39374c..5df006878f67a8 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 @@ -42,8 +42,8 @@ public static void Main() } [ExpectedWarning("IL2026", "--Method--")] - [ExpectedWarning("IL3002", "--Method--", Tool.Analyzer | Tool.NativeAot, "")] - [ExpectedWarning("IL3050", "--Method--", Tool.Analyzer | Tool.NativeAot, "")] + [ExpectedWarning("IL3002", "--Method--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] + [ExpectedWarning("IL3050", "--Method--", Tool.Analyzer | Tool.NativeAot, "NativeAOT-specific warning")] static void TestRequiresInMethodFromCopiedAssembly() { var tmp = new RequiresInCopyAssembly(); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFromXML.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFromXML.cs index 44dc657bf6863d..23fcf687db3bd0 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFromXML.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsFromXML.cs @@ -8,8 +8,8 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression { [SkipKeptItemsValidation] [ExpectedNoWarnings] - [ExpectedWarning("IL2121", "IL2026", Tool.Trimmer, "", FileName = "DetectRedundantSuppressionsFromXML.xml", SourceLine = 7)] - [ExpectedWarning("IL2121", "IL2109", Tool.Trimmer, "", FileName = "DetectRedundantSuppressionsFromXML.xml", SourceLine = 12)] + [ExpectedWarning("IL2121", "IL2026", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/117170", FileName = "DetectRedundantSuppressionsFromXML.xml", SourceLine = 7)] + [ExpectedWarning("IL2121", "IL2109", Tool.Trimmer, "https://github.com/dotnet/runtime/issues/117170", FileName = "DetectRedundantSuppressionsFromXML.xml", SourceLine = 12)] [SetupLinkAttributesFile("DetectRedundantSuppressionsFromXML.xml")] public class DetectRedundantSuppressionsFromXML { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInAssembly.cs index 9207aabb11a6ca..485c432867ccef 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInAssembly.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, "https://github.com/dotnet/linker/issues/1971")] [assembly: UnconditionalSuppressMessage("Test", "IL2071:Redundant suppression, warning is not issued in this assembly")] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInCompilerGeneratedCode.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInCompilerGeneratedCode.cs index 2136232f910be8..2de2cc3337fdb2 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInCompilerGeneratedCode.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInCompilerGeneratedCode.cs @@ -34,7 +34,7 @@ public class RedundantSuppressionOnLocalMethod { public static void Test() { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] void LocalMethod() { @@ -52,7 +52,7 @@ public static void Test() Enumerable(); } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] static IEnumerable Enumerable() { @@ -63,7 +63,7 @@ static IEnumerable Enumerable() public class RedundantSuppressionInAsyncBody { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static async void Test() { @@ -71,7 +71,7 @@ public static async void Test() await MethodAsync(); } - [ExpectedWarning("IL2121", "IL2070", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2070", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2070")] static async Task MethodAsync() { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs index 0ed4b2c718dc9f..c086409b25dd33 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs @@ -51,7 +51,7 @@ public static string TrimmerCompatibleMethod() return "test"; } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public class RedundantSuppressionOnType { @@ -63,7 +63,7 @@ public static void Test() public class RedundantSuppressionOnMethod { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static void Test() { @@ -78,7 +78,7 @@ public static void Test() NestedType.TrimmerCompatibleMethod(); } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public class NestedType { @@ -98,7 +98,7 @@ public static void Test() public static string TrimmerCompatibleProperty { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] get { @@ -115,7 +115,7 @@ public static void Test() TrimmerCompatibleProperty = "test"; } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static string TrimmerCompatibleProperty { @@ -137,7 +137,7 @@ public static void Test() var property = TrimmerCompatibleProperty; } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static string TrimmerCompatibleProperty { @@ -155,7 +155,7 @@ public static void Test() TrimmerCompatibleProperty = "test"; } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static string TrimmerCompatibleProperty { @@ -173,7 +173,7 @@ public static void Test() typeof(RedundantSuppressionOnPropertyAccessedByReflection).GetProperty("TrimmerCompatibleProperty"); } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static string TrimmerCompatibleProperty { @@ -198,7 +198,7 @@ static void EventSubscriber(object sender, EventArgs e) public static event EventHandler TrimmerCompatibleEvent { - [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2072")] add { TrimmerCompatibleMethod(); } remove { } @@ -217,7 +217,7 @@ static void EventSubscriber(object sender, EventArgs e) } - [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2072")] public static event EventHandler TrimmerCompatibleEvent { @@ -233,7 +233,7 @@ public static void Test() typeof(RedundantSuppressionOnEventAccessedByReflection).GetEvent("TrimmerCompatibleEvent"); } - [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2072")] public static event EventHandler TrimmerCompatibleEvent { @@ -242,15 +242,15 @@ public static event EventHandler TrimmerCompatibleEvent } } - [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2072")] - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public class MultipleRedundantSuppressions { - [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2072")] - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] public static void Test() { @@ -260,7 +260,7 @@ public static void Test() public class RedundantAndUsedSuppressions { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2071")] [UnconditionalSuppressMessage("Test", "IL2072")] public static void Test() @@ -332,7 +332,7 @@ public static void Test() MethodMarkedRUC(); } - [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2072", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] [UnconditionalSuppressMessage("Test", "IL2072")] [RequiresUnreferencedCode("Test")] public static void MethodMarkedRUC() diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypesUsingTarget.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypesUsingTarget.cs index cbe07c8b3a9cd8..b0de0b0f115a14 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypesUsingTarget.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypesUsingTarget.cs @@ -37,7 +37,7 @@ public static string TrimmerCompatibleMethod() return "test"; } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] public class RedundantSuppressionOnType { public static void Test() @@ -48,7 +48,7 @@ public static void Test() public class RedundantSuppressionOnMethod { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] public static void Test() { TrimmerCompatibleMethod(); @@ -62,7 +62,7 @@ public static void Test() NestedType.TrimmerCompatibleMethod(); } - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] public class NestedType { public static void TrimmerCompatibleMethod() @@ -81,7 +81,7 @@ public static void Test() public static string TrimmerCompatibleProperty { - [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "")] + [ExpectedWarning("IL2121", "IL2071", Tool.Trimmer, "https://github.com/dotnet/linker/issues/1971")] get { return TrimmerCompatibleMethod();