From 635a84a0398d4327d82468728a54bf386d7a47e9 Mon Sep 17 00:00:00 2001 From: Tlakaelel Axayakatl Ceja Date: Tue, 20 Jul 2021 16:47:30 -0700 Subject: [PATCH 1/3] Bump sdk version in global.json Fix new analyzer recommendations about AsSpan and Contains(char) Disable ImplicitNamespaceImports Update Microsoft.NetCore.App.Ref used by analyzer to take new Runtime attribute changes Update analyzer to not use Message as a property in RequiresAssemblyFilesAttribute --- global.json | 2 +- .../RequiresAssemblyFilesCodeFixProvider.cs | 2 +- .../RequiresAnalyzerBase.cs | 11 +++-- .../RequiresAssemblyFilesAnalyzer.cs | 17 ++++--- src/linker/Linker.Steps/MarkStep.cs | 4 +- src/linker/Linker/Driver.cs | 4 +- .../Linker/MethodReferenceExtensions.cs | 3 +- src/linker/Linker/TypeReferenceExtensions.cs | 2 +- ...onditionalSuppressMessageAttributeState.cs | 5 +- .../LargeStaticArraysAnalyzer.cs | 2 +- .../ILLink.RoslynAnalyzer.Tests.csproj | 1 + .../RequiresAssemblyFilesAnalyzerTests.cs | 48 ++++++++++--------- .../TestCaseUtils.cs | 2 +- ...nconditionalSuppressMessageCodeFixTests.cs | 25 ++-------- .../ILLink.Tasks.Tests.csproj | 1 + ...ono.Linker.Tests.Cases.Expectations.csproj | 3 ++ .../Mono.Linker.Tests.Cases.csproj | 1 + .../Mono.Linker.Tests.csproj | 1 + 18 files changed, 66 insertions(+), 68 deletions(-) diff --git a/global.json b/global.json index 16df7d4296bf..9108e4db7d6f 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "6.0.100-preview.5.21225.11", + "dotnet": "6.0.100-preview.7.21369.8", "runtimes": { "dotnet": [ "5.0.0" diff --git a/src/ILLink.CodeFix/RequiresAssemblyFilesCodeFixProvider.cs b/src/ILLink.CodeFix/RequiresAssemblyFilesCodeFixProvider.cs index 7837c183cb84..b172b7e51079 100644 --- a/src/ILLink.CodeFix/RequiresAssemblyFilesCodeFixProvider.cs +++ b/src/ILLink.CodeFix/RequiresAssemblyFilesCodeFixProvider.cs @@ -36,7 +36,7 @@ protected override SyntaxNode[] GetAttributeArguments (SemanticModel semanticMod if (string.IsNullOrEmpty (name) || HasPublicAccessibility (containingSymbol!)) { return Array.Empty (); } else { - return new[] { generator.AttributeArgument ("Message", generator.LiteralExpression ($"Calls {name}")) }; + return new[] { generator.AttributeArgument (generator.LiteralExpression ($"Calls {name}")) }; } } } diff --git a/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs b/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs index 6c9498a30e2c..7f1967028375 100644 --- a/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs +++ b/src/ILLink.RoslynAnalyzer/RequiresAnalyzerBase.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; using System.Linq; using ILLink.Shared; using Microsoft.CodeAnalysis; @@ -116,7 +117,7 @@ void CheckStaticConstructors (OperationAnalysisContext operationContext, ImmutableArray staticConstructors) { foreach (var staticConstructor in staticConstructors) { - if (staticConstructor.HasAttribute (RequiresAttributeName) && TryGetRequiresAttribute (staticConstructor, out AttributeData? requiresAttribute)) + if (staticConstructor.HasAttribute (RequiresAttributeName) && TryGetRequiresAttribute (staticConstructor, out var requiresAttribute)) ReportRequiresDiagnostic (operationContext, staticConstructor, requiresAttribute); } } @@ -149,7 +150,7 @@ void CheckCalledMember ( while (member is IMethodSymbol method && method.OverriddenMethod != null && SymbolEqualityComparer.Default.Equals (method.ReturnType, method.OverriddenMethod.ReturnType)) member = method.OverriddenMethod; - if (TryGetRequiresAttribute (member, out AttributeData? requiresAttribute)) { + if (TryGetRequiresAttribute (member, out var requiresAttribute)) { ReportRequiresDiagnostic (operationContext, member, requiresAttribute); } } @@ -227,7 +228,7 @@ private static ISymbol FindContainingSymbol (OperationAnalysisContext operationC /// Analyzer operation context to be able to report the diagnostic. /// Information about the member that generated the diagnostic. /// Requires attribute data to print attribute arguments. - private void ReportRequiresDiagnostic (OperationAnalysisContext operationContext, ISymbol member, AttributeData? requiresAttribute) + private void ReportRequiresDiagnostic (OperationAnalysisContext operationContext, ISymbol member, AttributeData requiresAttribute) { var message = GetMessageFromAttribute (requiresAttribute); var url = GetUrlFromAttribute (requiresAttribute); @@ -250,7 +251,7 @@ private void ReportMismatchInAttributesDiagnostic (SymbolAnalysisContext symbolA private bool HasMismatchingAttributes (ISymbol member1, ISymbol member2) => member1.HasAttribute (RequiresAttributeName) ^ member2.HasAttribute (RequiresAttributeName); - protected abstract string GetMessageFromAttribute (AttributeData? requiresAttribute); + protected abstract string GetMessageFromAttribute (AttributeData requiresAttribute); private string GetUrlFromAttribute (AttributeData? requiresAttribute) { @@ -264,7 +265,7 @@ private string GetUrlFromAttribute (AttributeData? requiresAttribute) /// Symbol of the member to search attribute. /// Output variable in case of matching Requires attribute. /// True if the member contains a Requires attribute; otherwise, returns false. - private bool TryGetRequiresAttribute (ISymbol member, out AttributeData? requiresAttribute) + private bool TryGetRequiresAttribute (ISymbol member, [NotNullWhen (returnValue: true)] out AttributeData? requiresAttribute) { requiresAttribute = null; foreach (var _attribute in member.GetAttributes ()) { diff --git a/src/ILLink.RoslynAnalyzer/RequiresAssemblyFilesAnalyzer.cs b/src/ILLink.RoslynAnalyzer/RequiresAssemblyFilesAnalyzer.cs index a0a6aa9de9fa..dbce10d380db 100644 --- a/src/ILLink.RoslynAnalyzer/RequiresAssemblyFilesAnalyzer.cs +++ b/src/ILLink.RoslynAnalyzer/RequiresAssemblyFilesAnalyzer.cs @@ -123,15 +123,18 @@ protected override bool ReportSpecialIncompatibleMembersDiagnostic (OperationAna return false; } - protected override bool VerifyAttributeArguments (AttributeData attribute) => attribute.ConstructorArguments.Length == 0; + protected override bool VerifyAttributeArguments (AttributeData attribute) => attribute.ConstructorArguments.Length == 0 || + attribute.ConstructorArguments.Length >= 1 && attribute.ConstructorArguments[0] is { Type: { SpecialType: SpecialType.System_String } } ctorArg; - protected override string GetMessageFromAttribute (AttributeData? requiresAttribute) + protected override string GetMessageFromAttribute (AttributeData requiresAttribute) { - var message = requiresAttribute?.NamedArguments.FirstOrDefault (na => na.Key == "Message").Value.Value?.ToString (); - if (!string.IsNullOrEmpty (message)) - message = $" {message}{(message!.TrimEnd ().EndsWith (".") ? "" : ".")}"; - - return message!; + string message = ""; + if (requiresAttribute.ConstructorArguments.Length >= 1) { + message = requiresAttribute.ConstructorArguments[0].Value?.ToString () ?? ""; + if (!string.IsNullOrEmpty (message)) + message = $" {message}{(message!.TrimEnd ().EndsWith (".") ? "" : ".")}"; + } + return message; } } } diff --git a/src/linker/Linker.Steps/MarkStep.cs b/src/linker/Linker.Steps/MarkStep.cs index 39f70f6225c5..bd4c0e61c656 100644 --- a/src/linker/Linker.Steps/MarkStep.cs +++ b/src/linker/Linker.Steps/MarkStep.cs @@ -1052,7 +1052,7 @@ bool MarkDependencyMethod (TypeDefinition type, string name, string[] signature, bool marked = false; int arity_marker = name.IndexOf ('`'); - if (arity_marker < 1 || !int.TryParse (name.Substring (arity_marker + 1), out int arity)) { + if (arity_marker < 1 || !int.TryParse (name.AsSpan (arity_marker + 1), out int arity)) { arity = 0; } else { name = name.Substring (0, arity_marker); @@ -2035,7 +2035,7 @@ void MarkTypeWithDebuggerDisplayAttribute (TypeDefinition type, CustomAttribute // // We could implement support for this at some point, but for now it's important to make sure at least we don't crash trying to find some // method on the current type when it exists on some other type - if (methodName.Contains (".")) + if (methodName.Contains ('.')) continue; MethodDefinition method = GetMethodWithNoParameters (type, methodName); diff --git a/src/linker/Linker/Driver.cs b/src/linker/Linker/Driver.cs index 0674f479a7c4..f65749ad60e7 100644 --- a/src/linker/Linker/Driver.cs +++ b/src/linker/Linker/Driver.cs @@ -805,7 +805,7 @@ string Unquote (string arg) string[] values = value.Split (new char[] { ',', ';', ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (string v in values) { var id = v.Trim (); - if (!id.StartsWith ("IL", StringComparison.Ordinal) || !ushort.TryParse (id.Substring (2), out ushort code)) + if (!id.StartsWith ("IL", StringComparison.Ordinal) || !ushort.TryParse (id.AsSpan (2), out ushort code)) continue; yield return code; @@ -884,7 +884,7 @@ protected bool AddCustomStep (Pipeline pipeline, string arg) string customStepName; string targetName = null; bool before = false; - if (!arg.Contains (":")) { + if (!arg.Contains (':')) { customStepName = arg; } else { string[] parts = arg.Split (':'); diff --git a/src/linker/Linker/MethodReferenceExtensions.cs b/src/linker/Linker/MethodReferenceExtensions.cs index 695ab20435ba..2aff0ce28b3d 100644 --- a/src/linker/Linker/MethodReferenceExtensions.cs +++ b/src/linker/Linker/MethodReferenceExtensions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using Mono.Cecil; namespace Mono.Linker @@ -16,7 +17,7 @@ public static string GetDisplayName (this MethodReference method) var methodDefinition = method.Resolve (); if (methodDefinition != null && (methodDefinition.IsSetter || methodDefinition.IsGetter)) { // Append property name - string name = methodDefinition.IsSetter ? methodDefinition.Name.Substring (4) + ".set" : methodDefinition.Name.Substring (4) + ".get"; + string name = methodDefinition.IsSetter ? string.Concat (methodDefinition.Name.AsSpan (4), ".set") : string.Concat (methodDefinition.Name.AsSpan (4), ".get"); sb.Append (name); // Insert declaring type name and namespace sb.Insert (0, '.').Insert (0, method.DeclaringType.GetDisplayName ()); diff --git a/src/linker/Linker/TypeReferenceExtensions.cs b/src/linker/Linker/TypeReferenceExtensions.cs index 5ebc3d2ae943..3cec0242211a 100644 --- a/src/linker/Linker/TypeReferenceExtensions.cs +++ b/src/linker/Linker/TypeReferenceExtensions.cs @@ -100,7 +100,7 @@ void parseArrayDimensions (ArrayType at) sb.Append (']'); } - sb.Append (arrayType.Name.Substring (0, arrayType.Name.IndexOf ('['))); + sb.Append (arrayType.Name.AsSpan (0, arrayType.Name.IndexOf ('['))); parseArrayDimensions (arrayType); var element = arrayType.ElementType as ArrayType; while (element != null) { diff --git a/src/linker/Linker/UnconditionalSuppressMessageAttributeState.cs b/src/linker/Linker/UnconditionalSuppressMessageAttributeState.cs index 33e51a028a10..79a462bd3712 100644 --- a/src/linker/Linker/UnconditionalSuppressMessageAttributeState.cs +++ b/src/linker/Linker/UnconditionalSuppressMessageAttributeState.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using Mono.Cecil; @@ -109,7 +110,7 @@ static bool TryDecodeSuppressMessageAttributeData (CustomAttribute attribute, ou if (!(attribute.ConstructorArguments[1].Value is string warningId) || warningId.Length < 6 || !warningId.StartsWith ("IL") || - !int.TryParse (warningId.Substring (2, 4), out info.Id)) { + !int.TryParse (warningId.AsSpan (2, 4), out info.Id)) { return false; } diff --git a/src/tlens/TLens.Analyzers/LargeStaticArraysAnalyzer.cs b/src/tlens/TLens.Analyzers/LargeStaticArraysAnalyzer.cs index 28bb9e5861a5..c46fcc2c66d2 100644 --- a/src/tlens/TLens.Analyzers/LargeStaticArraysAnalyzer.cs +++ b/src/tlens/TLens.Analyzers/LargeStaticArraysAnalyzer.cs @@ -27,7 +27,7 @@ protected override void ProcessMethod (MethodDefinition method) if (!name.StartsWith ("__StaticArrayInitTypeSize=")) continue; - if (!int.TryParse (name.Substring (26), out int size)) + if (!int.TryParse (name.AsSpan (26), out int size)) throw new NotImplementedException (name); methods.Add ((size, method)); diff --git a/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj b/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj index c943d7558015..9bdb94806299 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj +++ b/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj @@ -3,6 +3,7 @@ enable false + true diff --git a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs index 4f66348badf5..cf09be77e9d8 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/RequiresAssemblyFilesAnalyzerTests.cs @@ -166,7 +166,7 @@ public Task RequiresAssemblyFilesWithMessageAndUrl () class C { - [RequiresAssemblyFiles (Message = ""Message from attribute"", Url = ""https://helpurl"")] + [RequiresAssemblyFiles (""Message from attribute"", Url = ""https://helpurl"")] void M1() { } @@ -231,13 +231,13 @@ void M1() M2(); } - [RequiresAssemblyFiles (Message = ""Warn from M2"")] + [RequiresAssemblyFiles (""Warn from M2"")] void M2() { M3(); } - [RequiresAssemblyFiles (Message = ""Warn from M3"")] + [RequiresAssemblyFiles (""Warn from M3"")] void M3() { } @@ -321,6 +321,8 @@ public void M() } }"; return VerifyRequiresAssemblyFilesAnalyzer (src, + // (8,13): warning IL3002: Using member 'System.Reflection.AssemblyName.CodeBase.get' which has 'RequiresAssemblyFilesAttribute' can break functionality when embedded in a single-file app. The code will return an empty string for assemblies embedded in a single-file app. + VerifyCS.Diagnostic (RequiresAssemblyFilesAnalyzer.IL3002).WithSpan (8, 13, 8, 23).WithArguments ("System.Reflection.AssemblyName.CodeBase.get", " The code will return an empty string for assemblies embedded in a single-file app.", ""), // (8,13): warning IL3000: 'System.Reflection.AssemblyName.CodeBase' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. VerifyCS.Diagnostic (RequiresAssemblyFilesAnalyzer.IL3000).WithSpan (8, 13, 8, 23).WithArguments ("System.Reflection.AssemblyName.CodeBase"), // (9,13): warning IL3000: 'System.Reflection.AssemblyName.EscapedCodeBase' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. @@ -445,7 +447,7 @@ public Task RequiresAssemblyFilesDiagnosticFix () using System.Diagnostics.CodeAnalysis; public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; int M2() => M1(); } @@ -469,18 +471,18 @@ public class F using System.Diagnostics.CodeAnalysis; public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; - [RequiresAssemblyFiles(Message = ""Calls M1"")] + [RequiresAssemblyFiles(""Calls M1"")] int M2() => M1(); } class D { - [RequiresAssemblyFiles(Message = ""Calls M1"")] + [RequiresAssemblyFiles(""Calls M1"")] public int M3(C c) => c.M1(); public class E { - [RequiresAssemblyFiles(Message = ""Calls M1"")] + [RequiresAssemblyFiles(""Calls M1"")] public int M4(C c) => c.M1(); } } @@ -561,7 +563,7 @@ public Task FixInPropertyDecl () public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; int M2 => M1(); @@ -572,10 +574,10 @@ public class C public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; - [RequiresAssemblyFiles(Message = ""Calls M1"")] + [RequiresAssemblyFiles(""Calls M1"")] int M2 => M1(); }"; return VerifyRequiresAssemblyFilesCodeFix ( @@ -642,7 +644,7 @@ public Task FixInLocalFunc () public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; Action M2() @@ -657,13 +659,13 @@ Action M2() public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; - [RequiresAssemblyFiles(Message = ""Calls Wrapper"")] + [RequiresAssemblyFiles(""Calls Wrapper"")] Action M2() { - [global::System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute(Message = ""Calls M1"")] void Wrapper () => M1(); + [global::System.Diagnostics.CodeAnalysis.RequiresAssemblyFilesAttribute(""Calls M1"")] void Wrapper () => M1(); return Wrapper; } }"; @@ -688,7 +690,7 @@ public Task FixInCtor () public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; public C () => M1(); @@ -699,7 +701,7 @@ public class C public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; [RequiresAssemblyFiles()] @@ -724,7 +726,7 @@ public Task FixInEvent () public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; public event EventHandler E1 @@ -742,7 +744,7 @@ public event EventHandler E1 public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; [RequiresAssemblyFiles()] @@ -773,7 +775,7 @@ public Task TestStaticCctorRequiresAssemblyFiles () class StaticCtor { - [RequiresAssemblyFiles (Message = ""Message for --TestStaticCtor--"")] + [RequiresAssemblyFiles (""Message for --TestStaticCtor--"")] static StaticCtor () { } @@ -799,7 +801,7 @@ class StaticCtorTriggeredByFieldAccess { public static int field; - [RequiresAssemblyFiles (Message = ""Message for --StaticCtorTriggeredByFieldAccess.Cctor--"")] + [RequiresAssemblyFiles (""Message for --StaticCtorTriggeredByFieldAccess.Cctor--"")] static StaticCtorTriggeredByFieldAccess () { field = 0; @@ -826,12 +828,12 @@ public Task TestStaticCtorTriggeredByMethodCall () class StaticCtorTriggeredByMethodCall { - [RequiresAssemblyFiles (Message = ""Message for --StaticCtorTriggeredByMethodCall.Cctor--"")] + [RequiresAssemblyFiles (""Message for --StaticCtorTriggeredByMethodCall.Cctor--"")] static StaticCtorTriggeredByMethodCall () { } - [RequiresAssemblyFiles (Message = ""Message for --StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--"")] + [RequiresAssemblyFiles (""Message for --StaticCtorTriggeredByMethodCall.TriggerStaticCtorMarking--"")] public void TriggerStaticCtorMarking () { } diff --git a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs index 6022d9a2989e..60da38b1462d 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/TestCaseUtils.cs @@ -22,7 +22,7 @@ public abstract class TestCaseUtils public static readonly ReferenceAssemblies Net6PreviewAssemblies = new ReferenceAssemblies ( "net6.0", - new PackageIdentity ("Microsoft.NETCore.App.Ref", "6.0.0-preview.5.21224.4"), + new PackageIdentity ("Microsoft.NETCore.App.Ref", "6.0.0-preview.7.21368.2"), Path.Combine ("ref", "net6.0")) .WithNuGetConfigFilePath (Path.Combine (TestCaseUtils.GetRepoRoot (), "NuGet.config")); diff --git a/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs b/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs index 38249eb3e65b..05fe2ba10359 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs +++ b/test/ILLink.RoslynAnalyzer.Tests/UnconditionalSuppressMessageCodeFixTests.cs @@ -49,26 +49,9 @@ static Task VerifyUnconditionalSuppressMessageCodeFixWithRAF ( DiagnosticResult[] baselineExpected, DiagnosticResult[] fixedExpected) { - var attributeDefinition = @" -namespace System.Diagnostics.CodeAnalysis -{ -#nullable enable - [AttributeUsage(AttributeTargets.Constructor | - AttributeTargets.Event | - AttributeTargets.Method | - AttributeTargets.Property, - Inherited = false, - AllowMultiple = false)] - public sealed class RequiresAssemblyFilesAttribute : Attribute - { - public RequiresAssemblyFilesAttribute() { } - public string? Message { get; set; } - public string? Url { get; set; } - } -}"; var test = new VerifyCSUSMwithRAF.Test { - TestCode = source + attributeDefinition, - FixedCode = fixedSource + attributeDefinition, + TestCode = source, + FixedCode = fixedSource, ReferenceAssemblies = TestCaseUtils.Net6PreviewAssemblies }; test.ExpectedDiagnostics.AddRange (baselineExpected); @@ -117,7 +100,7 @@ public Task SuppressRequiresAssemblyFilesFixer () using System.Diagnostics.CodeAnalysis; public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; int M2() => M1(); }"; @@ -125,7 +108,7 @@ public class C using System.Diagnostics.CodeAnalysis; public class C { - [RequiresAssemblyFiles(Message = ""message"")] + [RequiresAssemblyFiles(""message"")] public int M1() => 0; [UnconditionalSuppressMessage(""SingleFile"", ""IL3002:Avoid calling members marked with 'RequiresAssemblyFilesAttribute' when publishing as a single-file"", Justification = """")] int M2() => M1(); diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj index 21a8efc47086..4d41bd222e53 100644 --- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj +++ b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj @@ -2,6 +2,7 @@ false + true diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj index 35e3d8428b7c..d24b61f188e4 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj +++ b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj @@ -1,2 +1,5 @@ + + true + diff --git a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index 71a33ea86341..fccf69d0e555 100644 --- a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -6,6 +6,7 @@ 0 true false + true diff --git a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj index 9c9922b77145..e1d89df46ef0 100644 --- a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj +++ b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj @@ -2,6 +2,7 @@ true + true From 006804a3be27384e9456fe0f58f4813c5228817b Mon Sep 17 00:00:00 2001 From: Tlakaelel Axayakatl Ceja Date: Fri, 23 Jul 2021 16:28:26 -0700 Subject: [PATCH 2/3] PR comments --- Directory.Build.props | 1 + .../ILLink.RoslynAnalyzer.Tests.csproj | 1 - test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj | 1 - .../Mono.Linker.Tests.Cases.Expectations.csproj | 3 --- test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj | 1 - test/Mono.Linker.Tests/Mono.Linker.Tests.csproj | 1 - 6 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d07c1d081982..5d480a85cb88 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,7 @@ true + true diff --git a/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj b/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj index 9bdb94806299..c943d7558015 100644 --- a/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj +++ b/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj @@ -3,7 +3,6 @@ enable false - true diff --git a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj index 4d41bd222e53..21a8efc47086 100644 --- a/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj +++ b/test/ILLink.Tasks.Tests/ILLink.Tasks.Tests.csproj @@ -2,7 +2,6 @@ false - true diff --git a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj index d24b61f188e4..35e3d8428b7c 100644 --- a/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj +++ b/test/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj @@ -1,5 +1,2 @@ - - true - diff --git a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index fccf69d0e555..71a33ea86341 100644 --- a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -6,7 +6,6 @@ 0 true false - true diff --git a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj index e1d89df46ef0..9c9922b77145 100644 --- a/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj +++ b/test/Mono.Linker.Tests/Mono.Linker.Tests.csproj @@ -2,7 +2,6 @@ true - true From 78defa83189077f0eaf9e0eec4485a0361bd0570 Mon Sep 17 00:00:00 2001 From: Tlakaelel Axayakatl Ceja Date: Mon, 26 Jul 2021 15:22:11 -0700 Subject: [PATCH 3/3] Update cecil version --- external/cecil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/cecil b/external/cecil index a27b1fb8b08d..3bef7fc7b791 160000 --- a/external/cecil +++ b/external/cecil @@ -1 +1 @@ -Subproject commit a27b1fb8b08d412fbed56a053a5c0872ed9dba25 +Subproject commit 3bef7fc7b7910f826790ebfeccb381b76a650571