From 4c356de76a1a9f0df9f43ec1baa9feb0ddd73ce0 Mon Sep 17 00:00:00 2001 From: Mike Voorhees Date: Wed, 19 Jul 2023 15:40:46 -0400 Subject: [PATCH] Clean up debugger attributes tests. (#89011) * Remove `SetupLinkerKeepDebugMembersAttribute`. This isn't supported anymore by the linker. * Remove NETCOREAPP behavior difference in debugger attribute removal tests * Move `DebuggerDisplayAttributeOnTypeWithNonExistentMethod` to the `KeepDebugMembers` folder since that is the scenario this test is testing --- .../TestCasesRunner/ILCompilerOptionsBuilder.cs | 7 ---- .../TestCasesRunner/TestCaseLinkerOptions.cs | 1 - .../TestCasesRunner/TestCaseMetadataProvider.cs | 1 - .../Attributes.Debugger.KeepDebugMembersTests.g.cs | 6 ++++ .../Attributes.DebuggerTests.g.cs | 6 ---- .../SetupLinkerKeepDebugMembersAttribute.cs | 17 ---------- ...ebuggerDisplayAttributeOnAssemblyUsingTarget.cs | 15 --------- ...ayAttributeOnAssemblyUsingTargetOnUnusedType.cs | 11 ------ ...OnAssemblyUsingTargetTypeNameInOtherAssembly.cs | 16 --------- .../DebuggerDisplayAttributeOnType.cs | 19 ----------- .../DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs | 9 ----- ...rDisplayAttributeOnTypeWithNonExistentMethod.cs | 39 ---------------------- ...uggerTypeProxyAttributeOnAssemblyUsingTarget.cs | 17 ---------- .../DebuggerTypeProxyAttributeOnType.cs | 16 --------- ...ayAttributeOnAssemblyUsingTargetOnUnusedType.cs | 3 -- ...OnAssemblyUsingTargetTypeNameInOtherAssembly.cs | 3 -- ...ingTargetTypeNameOfNestedTypeInOtherAssembly.cs | 3 -- .../DebuggerDisplayAttributeOnGenerics.cs | 5 --- .../DebuggerDisplayAttributeOnType.cs | 4 --- ...rDisplayAttributeOnTypeWithNonExistentMethod.cs | 29 ++++++++++++++++ ...uggerTypeProxyAttributeOnAssemblyUsingTarget.cs | 3 -- .../DebuggerTypeProxyAttributeOnType.cs | 4 --- .../TestCasesRunner/LinkerArgumentBuilder.cs | 9 ----- .../TestCasesRunner/TestCaseLinkerOptions.cs | 1 - .../TestCasesRunner/TestCaseMetadataProvider.cs | 1 - 25 files changed, 35 insertions(+), 210 deletions(-) delete mode 100644 src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs delete mode 100644 src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs create mode 100644 src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs index 8d8d8c5..ce47eb5 100644 --- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs +++ b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs @@ -121,10 +121,6 @@ namespace Mono.Linker.Tests.TestCasesRunner { } - public virtual void AddKeepDebugMembers (string value) - { - } - public virtual void AddAssemblyAction (string action, string assembly) { switch (action) { @@ -208,9 +204,6 @@ namespace Mono.Linker.Tests.TestCasesRunner if (!string.IsNullOrEmpty (options.LinkSymbols)) AddLinkSymbols (options.LinkSymbols); - if (!string.IsNullOrEmpty (options.KeepDebugMembers)) - AddKeepDebugMembers (options.KeepDebugMembers); - AddSkipUnresolved (options.SkipUnresolved); AddStripDescriptors (options.StripDescriptors); diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs index d5b512e..a92738b 100644 --- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs +++ b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs @@ -18,7 +18,6 @@ namespace Mono.Linker.Tests.TestCasesRunner public bool IgnoreSubstitutions; public bool IgnoreLinkAttributes; public string KeepTypeForwarderOnlyAssemblies; - public string KeepDebugMembers; public string LinkSymbols; public bool SkipUnresolved; public bool StripDescriptors; diff --git a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs index e7250ab..6aef3b5 100644 --- a/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs +++ b/src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs @@ -27,7 +27,6 @@ namespace Mono.Linker.Tests.TestCasesRunner IgnoreSubstitutions = GetOptionAttributeValue (nameof (IgnoreSubstitutionsAttribute), true), IgnoreLinkAttributes = GetOptionAttributeValue (nameof (IgnoreLinkAttributesAttribute), true), KeepTypeForwarderOnlyAssemblies = GetOptionAttributeValue (nameof (KeepTypeForwarderOnlyAssembliesAttribute), string.Empty), - KeepDebugMembers = GetOptionAttributeValue (nameof (SetupLinkerKeepDebugMembersAttribute), string.Empty), LinkSymbols = GetOptionAttributeValue (nameof (SetupLinkerLinkSymbolsAttribute), string.Empty), TrimMode = GetOptionAttributeValue (nameof (SetupLinkerTrimModeAttribute), null), DefaultAssembliesAction = GetOptionAttributeValue (nameof (SetupLinkerDefaultActionAttribute), null), diff --git a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.Debugger.KeepDebugMembersTests.g.cs b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.Debugger.KeepDebugMembersTests.g.cs index f9b9045..cd4a3ed 100644 --- a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.Debugger.KeepDebugMembersTests.g.cs +++ b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.Debugger.KeepDebugMembersTests.g.cs @@ -64,6 +64,12 @@ namespace ILLink.RoslynAnalyzer.Tests.Attributes.Debugger } [Fact] + public Task DebuggerDisplayAttributeOnTypeWithNonExistentMethod () + { + return RunTest (allowMissingWarnings: true); + } + + [Fact] public Task DebuggerDisplayOnTypeWithCallToExtensionMethodOnFieldType () { return RunTest (allowMissingWarnings: true); diff --git a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.DebuggerTests.g.cs b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.DebuggerTests.g.cs index ce49d1c..5cf889e 100644 --- a/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.DebuggerTests.g.cs +++ b/src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.DebuggerTests.g.cs @@ -46,12 +46,6 @@ namespace ILLink.RoslynAnalyzer.Tests.Attributes } [Fact] - public Task DebuggerDisplayAttributeOnTypeWithNonExistentMethod () - { - return RunTest (allowMissingWarnings: true); - } - - [Fact] public Task DebuggerTypeProxyAttributeOnAssemblyUsingTarget () { return RunTest (allowMissingWarnings: true); diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs deleted file mode 100644 index 2213b9c..0000000 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata -{ - [AttributeUsage (AttributeTargets.Class)] - public class SetupLinkerKeepDebugMembersAttribute : BaseMetadataAttribute - { - public SetupLinkerKeepDebugMembersAttribute (string value) - { - if (string.IsNullOrEmpty (value)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (value)); - } - } -} \ No newline at end of file diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs index 6514e80..a7f0c2b 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs @@ -3,26 +3,11 @@ using Mono.Linker.Tests.Cases.Attributes.Debugger; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -#if !NETCOREAPP -[assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] -#endif - [assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTarget.Foo))] namespace Mono.Linker.Tests.Cases.Attributes.Debugger { -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_Target(System.Type)")] -#endif public class DebuggerDisplayAttributeOnAssemblyUsingTarget { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs index 59b8fb6..033d190 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs @@ -1,23 +1,12 @@ using System.Diagnostics; using Mono.Linker.Tests.Cases.Attributes.Debugger; -using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; [assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.Foo))] namespace Mono.Linker.Tests.Cases.Attributes.Debugger { -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] -#endif public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs index 7c81962..feff427 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs @@ -3,28 +3,12 @@ using Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -#if !NETCOREAPP -[assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] -#endif - [assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib, library")] namespace Mono.Linker.Tests.Cases.Attributes.Debugger { [SetupCompileBefore ("library.dll", new[] { typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib) })] - -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")] -#endif [RemovedMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "get_Property()")] [KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "set_Property(System.Int32)")] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs index a78ee54..2671331 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs @@ -4,17 +4,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger { -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] -#endif public class DebuggerDisplayAttributeOnType { public static void Main () @@ -26,9 +16,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger [Kept] [KeptMember (".ctor()")] -#if !NETCOREAPP - [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] -#endif [DebuggerDisplay ("{Property}")] class Foo { @@ -37,9 +24,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger [Kept] [KeptMember (".ctor()")] -#if !NETCOREAPP - [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] -#endif [DebuggerDisplay ("{Method()}")] class Bar { @@ -51,9 +35,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger [Kept] [KeptMember (".ctor()")] -#if !NETCOREAPP - [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] -#endif [DebuggerDisplay (null)] class Baz { diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs index 8df3041..ddd6a69 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs @@ -1,18 +1,9 @@ using System.Diagnostics; -using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger { -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] -#endif public class DebuggerDisplayAttributeOnTypeThatIsNotUsed { public static void Main () diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs deleted file mode 100644 index 39d6d77..0000000 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs +++ /dev/null @@ -1,39 +0,0 @@ -#define FLAG - -using System.Diagnostics; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Attributes.Debugger -{ -#if !NETCOREAPP - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")] -#endif - public class DebuggerDisplayAttributeOnTypeWithNonExistentMethod - { - public static void Main () - { - var bar = new Bar (); - } - - [Kept] - [KeptMember (".ctor()")] - [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] - [DebuggerDisplay ("{Method()}")] - class Bar - { -#if !FLAG - public int Method () - { - return 1; - } -#endif - } - } -} \ No newline at end of file diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs index 1a0c432..6150082 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs @@ -3,25 +3,11 @@ using Mono.Linker.Tests.Cases.Attributes.Debugger; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Metadata; -#if !NETCOREAPP -[assembly: KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))] -#endif - [assembly: DebuggerTypeProxy (typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))] namespace Mono.Linker.Tests.Cases.Attributes.Debugger { -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")] -#endif public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget { public static void Main () @@ -38,9 +24,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger [KeptBackingField] public int Property { get; [Kept] set; } -#if !NETCOREAPP - [Kept] -#endif internal class FooDebugView { private Foo _foo; diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs index b227081..d7909cf 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs @@ -4,17 +4,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger { -#if NETCOREAPP [SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")] -#else - [SetupLinkerTrimMode ("link")] - [SetupLinkerKeepDebugMembers ("false")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - [KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")] -#endif public class DebuggerTypeProxyAttributeOnType { public static void Main () @@ -24,17 +14,11 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger [Kept] [KeptMember (".ctor()")] -#if !NETCOREAPP - [KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))] -#endif [DebuggerTypeProxy (typeof (FooDebugView))] class Foo { } -#if !NETCOREAPP - [Kept] -#endif class FooDebugView { public FooDebugView (Foo foo) diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs index f61b097..fca51b2 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs @@ -9,9 +9,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SetupLinkerTrimMode ("link")] -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs index 1bf43e9..a1708e3 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs @@ -11,9 +11,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SetupLinkerTrimMode ("link")] -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif [SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs index ff05b53..b7bf3b2 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs @@ -10,9 +10,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SetupLinkerTrimMode ("link")] -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif [SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })] // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnGenerics.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnGenerics.cs index ea0c2e6..2d99b15 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnGenerics.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnGenerics.cs @@ -1,13 +1,8 @@ using System.Diagnostics; using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] public class DebuggerDisplayAttributeOnGenerics diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs index 74ab32f..5db3713 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs @@ -6,10 +6,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SetupLinkerTrimMode ("link")] -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs new file mode 100644 index 0000000..1673831 --- /dev/null +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs @@ -0,0 +1,29 @@ +#define FLAG + +using System.Diagnostics; +using Mono.Linker.Tests.Cases.Expectations.Assertions; + +namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers +{ + public class DebuggerDisplayAttributeOnTypeWithNonExistentMethod + { + public static void Main () + { + var bar = new Bar (); + } + + [Kept] + [KeptMember (".ctor()")] + [KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))] + [DebuggerDisplay ("{Method()}")] + class Bar + { +#if !FLAG + public int Method () + { + return 1; + } +#endif + } + } +} \ No newline at end of file diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs index d6304e5..d448bfe 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs @@ -10,9 +10,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SetupLinkerTrimMode ("link")] -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] diff --git a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs index 7a12b03..bf815b4 100644 --- a/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs +++ b/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerTypeProxyAttributeOnType.cs @@ -6,10 +6,6 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers { [SetupLinkerTrimMode ("link")] -#if !NETCOREAPP - [SetupLinkerKeepDebugMembers ("true")] -#endif - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs index ae0673e..3164478 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/LinkerArgumentBuilder.cs @@ -106,12 +106,6 @@ namespace Mono.Linker.Tests.TestCasesRunner Append (value); } - public virtual void AddKeepDebugMembers (string value) - { - Append ("-v"); - Append (value); - } - public virtual void AddAssemblyAction (string action, string assembly) { Append ("--action"); @@ -219,9 +213,6 @@ namespace Mono.Linker.Tests.TestCasesRunner if (!string.IsNullOrEmpty (options.LinkSymbols)) AddLinkSymbols (options.LinkSymbols); - if (!string.IsNullOrEmpty (options.KeepDebugMembers)) - AddKeepDebugMembers (options.KeepDebugMembers); - AddSkipUnresolved (options.SkipUnresolved); AddStripDescriptors (options.StripDescriptors); diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs index 67b2965..de2f030 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs @@ -15,7 +15,6 @@ namespace Mono.Linker.Tests.TestCasesRunner public bool IgnoreDescriptors; public bool IgnoreSubstitutions; public bool IgnoreLinkAttributes; - public string KeepDebugMembers; public string LinkSymbols; public bool SkipUnresolved; public bool StripDescriptors; diff --git a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs index 6f0ba6d..ae2a1de 100644 --- a/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs +++ b/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs @@ -27,7 +27,6 @@ namespace Mono.Linker.Tests.TestCasesRunner IgnoreDescriptors = GetOptionAttributeValue (nameof (IgnoreDescriptorsAttribute), true), IgnoreSubstitutions = GetOptionAttributeValue (nameof (IgnoreSubstitutionsAttribute), true), IgnoreLinkAttributes = GetOptionAttributeValue (nameof (IgnoreLinkAttributesAttribute), true), - KeepDebugMembers = GetOptionAttributeValue (nameof (SetupLinkerKeepDebugMembersAttribute), string.Empty), LinkSymbols = GetOptionAttributeValue (nameof (SetupLinkerLinkSymbolsAttribute), string.Empty), TrimMode = GetOptionAttributeValue (nameof (SetupLinkerTrimModeAttribute), null), DefaultAssembliesAction = GetOptionAttributeValue (nameof (SetupLinkerDefaultActionAttribute), null), -- 2.7.4