Skip to content

Commit e38c157

Browse files
committed
Clean up debugger attributes tests.
* 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
1 parent dedaf46 commit e38c157

25 files changed

+35
-210
lines changed

src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/ILCompilerOptionsBuilder.cs

-7
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ public virtual void AddLinkSymbols (string value)
121121
{
122122
}
123123

124-
public virtual void AddKeepDebugMembers (string value)
125-
{
126-
}
127-
128124
public virtual void AddAssemblyAction (string action, string assembly)
129125
{
130126
switch (action) {
@@ -208,9 +204,6 @@ public virtual void ProcessOptions (TestCaseLinkerOptions options)
208204
if (!string.IsNullOrEmpty (options.LinkSymbols))
209205
AddLinkSymbols (options.LinkSymbols);
210206

211-
if (!string.IsNullOrEmpty (options.KeepDebugMembers))
212-
AddKeepDebugMembers (options.KeepDebugMembers);
213-
214207
AddSkipUnresolved (options.SkipUnresolved);
215208

216209
AddStripDescriptors (options.StripDescriptors);

src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseLinkerOptions.cs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class TestCaseLinkerOptions
1818
public bool IgnoreSubstitutions;
1919
public bool IgnoreLinkAttributes;
2020
public string KeepTypeForwarderOnlyAssemblies;
21-
public string KeepDebugMembers;
2221
public string LinkSymbols;
2322
public bool SkipUnresolved;
2423
public bool StripDescriptors;

src/coreclr/tools/aot/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public virtual TestCaseLinkerOptions GetLinkerOptions (NPath inputPath)
2727
IgnoreSubstitutions = GetOptionAttributeValue (nameof (IgnoreSubstitutionsAttribute), true),
2828
IgnoreLinkAttributes = GetOptionAttributeValue (nameof (IgnoreLinkAttributesAttribute), true),
2929
KeepTypeForwarderOnlyAssemblies = GetOptionAttributeValue (nameof (KeepTypeForwarderOnlyAssembliesAttribute), string.Empty),
30-
KeepDebugMembers = GetOptionAttributeValue (nameof (SetupLinkerKeepDebugMembersAttribute), string.Empty),
3130
LinkSymbols = GetOptionAttributeValue (nameof (SetupLinkerLinkSymbolsAttribute), string.Empty),
3231
TrimMode = GetOptionAttributeValue<string> (nameof (SetupLinkerTrimModeAttribute), null),
3332
DefaultAssembliesAction = GetOptionAttributeValue<string> (nameof (SetupLinkerDefaultActionAttribute), null),

src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.Debugger.KeepDebugMembersTests.g.cs

+6
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ public Task DebuggerDisplayAttributeOnTypeThatIsNotUsed ()
6363
return RunTest (allowMissingWarnings: true);
6464
}
6565

66+
[Fact]
67+
public Task DebuggerDisplayAttributeOnTypeWithNonExistentMethod ()
68+
{
69+
return RunTest (allowMissingWarnings: true);
70+
}
71+
6672
[Fact]
6773
public Task DebuggerDisplayOnTypeWithCallToExtensionMethodOnFieldType ()
6874
{

src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Attributes.DebuggerTests.g.cs

-6
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ public Task DebuggerDisplayAttributeOnTypeThatIsNotUsed ()
4545
return RunTest (allowMissingWarnings: true);
4646
}
4747

48-
[Fact]
49-
public Task DebuggerDisplayAttributeOnTypeWithNonExistentMethod ()
50-
{
51-
return RunTest (allowMissingWarnings: true);
52-
}
53-
5448
[Fact]
5549
public Task DebuggerTypeProxyAttributeOnAssemblyUsingTarget ()
5650
{

src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerKeepDebugMembersAttribute.cs

-17
This file was deleted.

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTarget.cs

-15
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,11 @@
33
using Mono.Linker.Tests.Cases.Expectations.Assertions;
44
using Mono.Linker.Tests.Cases.Expectations.Metadata;
55

6-
#if !NETCOREAPP
7-
[assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
8-
#endif
9-
106
[assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTarget.Foo))]
117

128
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
139
{
14-
#if NETCOREAPP
1510
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
16-
#else
17-
[SetupLinkerTrimMode ("link")]
18-
[SetupLinkerKeepDebugMembers ("false")]
19-
20-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
21-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
22-
23-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
24-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_Target(System.Type)")]
25-
#endif
2611
public class DebuggerDisplayAttributeOnAssemblyUsingTarget
2712
{
2813
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs

-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
11
using System.Diagnostics;
22
using Mono.Linker.Tests.Cases.Attributes.Debugger;
3-
using Mono.Linker.Tests.Cases.Expectations.Assertions;
43
using Mono.Linker.Tests.Cases.Expectations.Metadata;
54

65
[assembly: DebuggerDisplay ("{Property}", Target = typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.Foo))]
76

87
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
98
{
10-
#if NETCOREAPP
119
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
12-
#else
13-
[SetupLinkerTrimMode ("link")]
14-
[SetupLinkerKeepDebugMembers ("false")]
15-
16-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
17-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
18-
19-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
20-
#endif
2110
public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType
2211
{
2312
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs

-16
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,12 @@
33
using Mono.Linker.Tests.Cases.Expectations.Assertions;
44
using Mono.Linker.Tests.Cases.Expectations.Metadata;
55

6-
#if !NETCOREAPP
7-
[assembly: KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
8-
#endif
9-
106
[assembly: DebuggerDisplay ("{Property}", TargetTypeName = "Mono.Linker.Tests.Cases.Attributes.Debugger.Dependencies.DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib, library")]
117

128
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
139
{
1410
[SetupCompileBefore ("library.dll", new[] { typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib) })]
15-
16-
#if NETCOREAPP
1711
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
18-
#else
19-
[SetupLinkerTrimMode ("link")]
20-
[SetupLinkerKeepDebugMembers ("false")]
21-
22-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
23-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
24-
25-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
26-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")]
27-
#endif
2812

2913
[RemovedMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "get_Property()")]
3014
[KeptMemberInAssembly ("library.dll", typeof (DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib), "set_Property(System.Int32)")]

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnType.cs

-19
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,7 @@
44

55
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
66
{
7-
#if NETCOREAPP
87
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
9-
#else
10-
[SetupLinkerTrimMode ("link")]
11-
[SetupLinkerKeepDebugMembers ("false")]
12-
13-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
14-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
15-
16-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
17-
#endif
188
public class DebuggerDisplayAttributeOnType
199
{
2010
public static void Main ()
@@ -26,9 +16,6 @@ public static void Main ()
2616

2717
[Kept]
2818
[KeptMember (".ctor()")]
29-
#if !NETCOREAPP
30-
[KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
31-
#endif
3219
[DebuggerDisplay ("{Property}")]
3320
class Foo
3421
{
@@ -37,9 +24,6 @@ class Foo
3724

3825
[Kept]
3926
[KeptMember (".ctor()")]
40-
#if !NETCOREAPP
41-
[KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
42-
#endif
4327
[DebuggerDisplay ("{Method()}")]
4428
class Bar
4529
{
@@ -51,9 +35,6 @@ public int Method ()
5135

5236
[Kept]
5337
[KeptMember (".ctor()")]
54-
#if !NETCOREAPP
55-
[KeptAttributeAttribute (typeof (DebuggerDisplayAttribute))]
56-
#endif
5738
[DebuggerDisplay (null)]
5839
class Baz
5940
{

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeThatIsNotUsed.cs

-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
11
using System.Diagnostics;
2-
using Mono.Linker.Tests.Cases.Expectations.Assertions;
32
using Mono.Linker.Tests.Cases.Expectations.Metadata;
43

54
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
65
{
7-
#if NETCOREAPP
86
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
9-
#else
10-
[SetupLinkerTrimMode ("link")]
11-
[SetupLinkerKeepDebugMembers ("false")]
12-
13-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
14-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
15-
#endif
167
public class DebuggerDisplayAttributeOnTypeThatIsNotUsed
178
{
189
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerDisplayAttributeOnTypeWithNonExistentMethod.cs

-39
This file was deleted.

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnAssemblyUsingTarget.cs

-17
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,11 @@
33
using Mono.Linker.Tests.Cases.Expectations.Assertions;
44
using Mono.Linker.Tests.Cases.Expectations.Metadata;
55

6-
#if !NETCOREAPP
7-
[assembly: KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))]
8-
#endif
9-
106
[assembly: DebuggerTypeProxy (typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo.FooDebugView), Target = typeof (DebuggerTypeProxyAttributeOnAssemblyUsingTarget.Foo))]
117

128
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
139
{
14-
#if NETCOREAPP
1510
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
16-
#else
17-
[SetupLinkerTrimMode ("link")]
18-
[SetupLinkerKeepDebugMembers ("false")]
19-
20-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
21-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
22-
23-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")]
24-
#endif
2511
public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget
2612
{
2713
public static void Main ()
@@ -38,9 +24,6 @@ public class Foo
3824
[KeptBackingField]
3925
public int Property { get; [Kept] set; }
4026

41-
#if !NETCOREAPP
42-
[Kept]
43-
#endif
4427
internal class FooDebugView
4528
{
4629
private Foo _foo;

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/DebuggerTypeProxyAttributeOnType.cs

-16
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,7 @@
44

55
namespace Mono.Linker.Tests.Cases.Attributes.Debugger
66
{
7-
#if NETCOREAPP
87
[SetupLinkAttributesFile ("DebuggerAttributesRemoved.xml")]
9-
#else
10-
[SetupLinkerTrimMode ("link")]
11-
[SetupLinkerKeepDebugMembers ("false")]
12-
13-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
14-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
15-
16-
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")]
17-
#endif
188
public class DebuggerTypeProxyAttributeOnType
199
{
2010
public static void Main ()
@@ -24,17 +14,11 @@ public static void Main ()
2414

2515
[Kept]
2616
[KeptMember (".ctor()")]
27-
#if !NETCOREAPP
28-
[KeptAttributeAttribute (typeof (DebuggerTypeProxyAttribute))]
29-
#endif
3017
[DebuggerTypeProxy (typeof (FooDebugView))]
3118
class Foo
3219
{
3320
}
3421

35-
#if !NETCOREAPP
36-
[Kept]
37-
#endif
3822
class FooDebugView
3923
{
4024
public FooDebugView (Foo foo)

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType.cs

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1010
{
1111
[SetupLinkerTrimMode ("link")]
12-
#if !NETCOREAPP
13-
[SetupLinkerKeepDebugMembers ("true")]
14-
#endif
1512

1613
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
1714
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1212
{
1313
[SetupLinkerTrimMode ("link")]
14-
#if !NETCOREAPP
15-
[SetupLinkerKeepDebugMembers ("true")]
16-
#endif
1714
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]
1815

1916
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfNestedTypeInOtherAssembly.cs

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1111
{
1212
[SetupLinkerTrimMode ("link")]
13-
#if !NETCOREAPP
14-
[SetupLinkerKeepDebugMembers ("true")]
15-
#endif
1613
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]
1714

1815
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnGenerics.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
using System.Diagnostics;
22
using Mono.Linker.Tests.Cases.Expectations.Assertions;
3-
using Mono.Linker.Tests.Cases.Expectations.Metadata;
43

54
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
65
{
7-
#if !NETCOREAPP
8-
[SetupLinkerKeepDebugMembers ("true")]
9-
#endif
10-
116
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
127
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
138
public class DebuggerDisplayAttributeOnGenerics

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnType.cs

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
77
{
88
[SetupLinkerTrimMode ("link")]
9-
#if !NETCOREAPP
10-
[SetupLinkerKeepDebugMembers ("true")]
11-
#endif
12-
139
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
1410
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
1511

0 commit comments

Comments
 (0)