Skip to content

Commit 6229f5f

Browse files
authored
Redo ILVerfificaiton (#90418)
* Now checks all assemblies in the output directory rather than just `test.exe` * Once again respects the the ability to skip verifying a single assembly via `[SkipIlVerify("foo.dll")]` * Now loads core libraries from the output directory (if they exist) instead of from the runtime install dir. * ALC logic was removed. I do not understand what value this provided. * The class libraries lead to a lot of errors. Rather than having to filter out a large number of errors, I added diff'ing. ILVerify will check the input assembly and remove any errors that existed in the input assembly. This makes verifying class libraries viable. Without it, you'd have to use `[SkipIlverify]` on every core link test or filter out a lot of `VerifierError` values. * Moved IL verification back to `InitialChecking` where `PeVerifier` was * Add a test to verify that il verification is mostly working. It doesn't give complete coverage over every behavior, but it's better than nothing. * `SkipPeVerify` renamed to `SkipIlVerify` * `SkipPeVerifyForToolchian` was removed. There is only 1 tool now. * Removed `PeVerifier`. * Remove many [SkipIlVerify] attributes. Diffing means they are no longer needed * `ValidateTypeRefsHaveValidAssemblyRefs` now runs regardless of whether or not the IL is verified. It wasn't clear to me why this logic would only be useful when il was verified. * Change `UninitializedLocals` to use `ExpectIlFailure`. This test seems to expect invalid il. Might as well assert that rather than skip ilverify entirely. * Remove the logic that disables ilverify when a test uses the unsafe argument. Diffing makes this obsolete. * IL Verification errors have been greatly improved. ** will now output all IL errors in the failure message rather than just the first invalid IL. ** Type and Method names are now displayed in the error message. I didn't do an exhaustive implementation, SRM is so tedious to use, but it's better than not having it ** Tokens and Offsets are formatted nicely * Extension points opened up for Unity. ** We need to supply different search directories. ** We need to search for `.winmd` files since we support windows runtime. ** In general I opened some things up in case we need to call them
1 parent 5ef2a9b commit 6229f5f

File tree

60 files changed

+653
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+653
-314
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,6 @@ public ResultChecker (BaseAssemblyResolver originalsResolver,
4545
_linkedReaderParameters = linkedReaderParameters;
4646
}
4747

48-
private static bool ShouldValidateIL (AssemblyDefinition inputAssembly)
49-
{
50-
if (HasAttribute (inputAssembly, nameof (SkipPeVerifyAttribute)))
51-
return false;
52-
53-
var caaIsUnsafeFlag = (CustomAttributeArgument caa) =>
54-
(caa.Type.Name == "String" && caa.Type.Namespace == "System")
55-
&& (string) caa.Value == "/unsafe";
56-
var customAttributeHasUnsafeFlag = (CustomAttribute ca) => ca.ConstructorArguments.Any (caaIsUnsafeFlag);
57-
if (GetCustomAttributes (inputAssembly, nameof (SetupCompileArgumentAttribute))
58-
.Any (customAttributeHasUnsafeFlag))
59-
return false;
60-
61-
return true;
62-
}
63-
6448
public virtual void Check (ILCompilerTestCaseResult testResult)
6549
{
6650
InitializeResolvers (testResult);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ public Task CanVerifyInterfacesOnTypesInAssembly ()
7575
return RunTest (allowMissingWarnings: true);
7676
}
7777

78+
[Fact]
79+
public Task ILVerificationWorks ()
80+
{
81+
return RunTest (allowMissingWarnings: true);
82+
}
83+
7884
[Fact]
7985
public Task VerifyAttributesInAssemblyWorks ()
8086
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) .NET Foundation and contributors. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
6+
namespace Mono.Linker.Tests.Cases.Expectations.Assertions;
7+
8+
/// <summary>
9+
/// This attribute is used to disable removing il verification errors that appear in the input assembly from the output verification results.
10+
///
11+
/// The original motivation for this is to make it easier to write a test that mostly verifies that the test frameworks ability to check il is working
12+
/// correctly.
13+
/// </summary>
14+
[AttributeUsage (AttributeTargets.Class)]
15+
public class DisableILVerifyDiffingAttribute : BaseExpectedLinkedBehaviorAttribute
16+
{
17+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) .NET Foundation and contributors. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
6+
namespace Mono.Linker.Tests.Cases.Expectations.Assertions;
7+
8+
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
9+
public class ExpectILFailureAttribute : BaseExpectedLinkedBehaviorAttribute
10+
{
11+
public ExpectILFailureAttribute (params string[] messageContains)
12+
{
13+
}
14+
}

src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs renamed to src/tools/illink/test/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipILVerifyAttribute.cs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,14 @@
55

66
namespace Mono.Linker.Tests.Cases.Expectations.Assertions
77
{
8-
9-
public enum SkipPeVerifyForToolchian
10-
{
11-
Pedump
12-
}
13-
148
[AttributeUsage (AttributeTargets.Class, AllowMultiple = true)]
15-
public class SkipPeVerifyAttribute : BaseExpectedLinkedBehaviorAttribute
9+
public class SkipILVerifyAttribute : BaseExpectedLinkedBehaviorAttribute
1610
{
17-
public SkipPeVerifyAttribute ()
18-
{
19-
}
20-
21-
public SkipPeVerifyAttribute (SkipPeVerifyForToolchian toolchain)
11+
public SkipILVerifyAttribute ()
2212
{
2313
}
2414

25-
public SkipPeVerifyAttribute (string assemblyName)
15+
public SkipILVerifyAttribute (string assemblyName)
2616
{
2717
}
2818
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1414
[SetupLinkerKeepDebugMembers ("true")]
1515
#endif
1616

17-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
18-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
19-
2017
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
2118
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_Target(System.Type)")]
2219
public class DebuggerDisplayAttributeOnAssemblyUsingTarget

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1010
{
1111
[SetupLinkerTrimMode ("link")]
12-
13-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
14-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
15-
1612
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
1713
public class DebuggerDisplayAttributeOnAssemblyUsingTargetOnUnusedType
1814
{

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1313
[SetupLinkerTrimMode ("link")]
1414
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]
1515

16-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
17-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
18-
1916
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
2017
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")]
2118

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1313
[SetupLinkerKeepDebugMembers ("true")]
1414
#endif
1515

16-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
17-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
18-
1916
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
2017
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")]
2118
public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInSameAssembly

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1515
#endif
1616
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]
1717

18-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
19-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
20-
2118
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
2219
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")]
2320

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1212
[SetupLinkerTrimMode ("link")]
1313
[SetupCompileBefore ("library.dll", new[] { "../Dependencies/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.cs" })]
1414

15-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
16-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
17-
1815
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
1916
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), "set_TargetTypeName(System.String)")]
2017

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
55
{
6-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
7-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
86
public class DebuggerDisplayAttributeOnGenerics
97
{
108
public static void Main ()

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
77
{
88
[SetupLinkerTrimMode ("link")]
9-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
10-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
11-
129
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerDisplayAttribute), ".ctor(System.String)")]
1310
public class DebuggerDisplayAttributeOnType
1411
{

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
88
[SetupLinkerKeepDebugMembers ("true")]
99
#endif
1010

11-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
12-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
1311
public class DebuggerDisplayAttributeOnTypeThatIsNotUsed
1412
{
1513
public static void Main ()

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
1111
{
1212
[SetupLinkerTrimMode ("link")]
1313

14-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
15-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
16-
1714
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")]
1815
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), "set_Target(System.Type)")]
1916
public class DebuggerTypeProxyAttributeOnAssemblyUsingTarget

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
namespace Mono.Linker.Tests.Cases.Attributes.Debugger.KeepDebugMembers
77
{
88
[SetupLinkerTrimMode ("link")]
9-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
10-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
11-
129
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (DebuggerTypeProxyAttribute), ".ctor(System.Type)")]
1310
public class DebuggerTypeProxyAttributeOnType
1411
{

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
namespace Mono.Linker.Tests.Cases.Attributes
1010
{
11-
[SkipPeVerify]
1211
[Define ("REFERENCE_INCLUDED")]
1312
[SetupCompileBefore ("library.dll", new[] { "Dependencies/AttributeDefinedInReference.cs" })]
1413
[SetupLinkerAction ("skip", "library")]

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ namespace Mono.Linker.Tests.Cases.Attributes
1717
[KeptAttributeInAssembly ("System.dll", typeof (AssemblyDescriptionAttribute))]
1818
[KeptAttributeInAssembly ("System.dll", typeof (AssemblyCompanyAttribute))]
1919
#endif
20-
[SkipPeVerify]
2120
public class CoreLibraryAssemblyAttributesAreKept
2221
{
2322
public static void Main ()

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ namespace Mono.Linker.Tests.Cases.Attributes
88
/// The purpose of this test is mainly to provide coverage on the `KeptAttributeOnFixedBufferType` attribute
99
/// </summary>
1010
[SetupCompileArgument ("/unsafe")]
11-
// Can't verify because the test contains unsafe code
12-
[SkipPeVerify]
1311
public class FixedLengthArrayAttributesArePreserved
1412
{
1513
public static void Main ()

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
namespace Mono.Linker.Tests.Cases.Attributes
77
{
88
[SetupLinkerTrimMode ("link")]
9-
[SkipPeVerify]
10-
119
[KeptInterface (typeof (IUserData))]
1210
public class MarshalAsCustomMarshalerInterface : IUserData
1311
{

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/NoSecurity/CoreLibrarySecurityAttributeTypesAreRemoved.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.NoSecurity
2727
[RemovedTypeInAssembly (PlatformAssemblies.CoreLib, typeof (SecurityCriticalAttribute))]
2828
[RemovedTypeInAssembly (PlatformAssemblies.CoreLib, typeof (SecuritySafeCriticalAttribute))]
2929
[RemovedTypeInAssembly (PlatformAssemblies.CoreLib, typeof (SuppressUnmanagedCodeSecurityAttribute))]
30-
31-
// Fails with `Runtime critical type System.Reflection.CustomAttributeData not found` which is a known short coming
32-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
33-
[SkipPeVerify ("System.dll")]
34-
35-
// System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code
36-
// detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked.
37-
// PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output
38-
[SkipPeVerify ("System.Core.dll")]
3930
public class CoreLibrarySecurityAttributeTypesAreRemoved
4031
{
4132
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CanLinkCoreLibrariesWithOnlyKeepUsedAttributes.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
77
[SetupLinkerTrimMode ("link")]
88
[SetupLinkerArgument ("--used-attrs-only", "true")]
99
[Reference ("System.dll")]
10-
// System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code
11-
// detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked.
12-
// PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output
13-
[SkipPeVerify ("System.Core.dll")]
14-
// Fails with `Runtime critical type System.Reflection.CustomAttributeData not found`
15-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
16-
#if !NETCOREAPP
17-
// .NET Framework System.dll doesn't pass peverify
18-
[SkipPeVerify ("System.dll")]
19-
#endif
20-
2110
class CanLinkCoreLibrariesWithOnlyKeepUsedAttributes
2211
{
2312
static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUnusedAssemblyAttributesAreRemoved.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
1313
#if !NETCOREAPP
1414
[RemovedAttributeInAssembly ("System.dll", typeof (AssemblyDescriptionAttribute))]
1515
#endif
16-
[SkipPeVerify]
1716
public class CoreLibraryUnusedAssemblyAttributesAreRemoved
1817
{
1918
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/CoreLibraryUsedAssemblyAttributesAreKept.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
1313
#if !NETCOREAPP
1414
[KeptAttributeInAssembly ("System.dll", typeof (AssemblyDescriptionAttribute))]
1515
#endif
16-
[SkipPeVerify]
1716
public class CoreLibraryUsedAssemblyAttributesAreKept
1817
{
1918
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/FixedLengthArrayAttributesArePreserved.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
66
{
77
[SetupLinkerArgument ("--used-attrs-only", "true")]
88
[SetupCompileArgument ("/unsafe")]
9-
10-
// Can't verify because the test contains unsafe code
11-
[SkipPeVerify]
129
public class FixedLengthArrayAttributesArePreserved
1310
{
1411
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/NullableOnConstraints.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
88
[SetupCSharpCompilerToUse ("csc")]
99
[SetupLinkerArgument ("--used-attrs-only", "true")]
1010
[SetupLinkerTrimMode ("link")]
11+
[IgnoreDescriptors (false)]
1112
public class NullableOnConstraints
1213
{
1314
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeTypeOnMethodIsRemoved.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
namespace Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed
66
{
77
[SetupLinkerArgument ("--used-attrs-only", "true")]
8-
// System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code
9-
// detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked.
10-
// PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output
11-
[SkipPeVerify ("System.Core.dll")]
128
class UnusedAttributeTypeOnMethodIsRemoved
139
{
1410
static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ namespace Mono.Linker.Tests.Cases.CoreLink
1111

1212
[KeptAssembly (PlatformAssemblies.CoreLib)]
1313
[KeptAllTypesAndMembersInAssembly (PlatformAssemblies.CoreLib)]
14-
15-
[SkipPeVerify]
1614
class CopyOfCoreLibrariesKeepsUnusedTypes
1715
{
1816
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/CoreLink/DelegateAndMulticastDelegateKeepInstantiatedReqs.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Mono.Linker.Tests.Cases.CoreLink
99
{
1010
[TestCaseRequirements (TestRunCharacteristics.TargetingNetCore, "Only for .NET Core")]
1111
/// <summary>
12-
/// Delegate and is created from
12+
/// Delegate and is created from
1313
/// </summary>
1414
[SetupLinkerTrimMode ("link")]
1515
[KeptBaseOnTypeInAssembly (PlatformAssemblies.CoreLib, typeof (MulticastDelegate), PlatformAssemblies.CoreLib, typeof (Delegate))]
@@ -22,9 +22,6 @@ namespace Mono.Linker.Tests.Cases.CoreLink
2222
[KeptMemberInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), "Equals(System.Object)")]
2323
[KeptInterfaceOnTypeInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), PlatformAssemblies.CoreLib, typeof (ICloneable))]
2424
[KeptInterfaceOnTypeInAssembly (PlatformAssemblies.CoreLib, typeof (Delegate), PlatformAssemblies.CoreLib, typeof (ISerializable))]
25-
26-
// Fails due to Runtime critical type System.Reflection.CustomAttributeData not found.
27-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
2825
public class DelegateAndMulticastDelegateKeepInstantiatedReqs
2926
{
3027
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedStructWithOverridesFromObject.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
namespace Mono.Linker.Tests.Cases.CoreLink
55
{
66
[SetupLinkerTrimMode ("link")]
7-
// Need to skip due to `Runtime critical type System.Reflection.CustomAttributeData not found` failure
8-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
97
public class InstantiatedStructWithOverridesFromObject
108
{
119
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/CoreLink/InstantiatedTypeWithOverridesFromObject.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
namespace Mono.Linker.Tests.Cases.CoreLink
55
{
66
[SetupLinkerTrimMode ("link")]
7-
// Need to skip due to `Runtime critical type System.Reflection.CustomAttributeData not found` failure
8-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
97
public class InstantiatedTypeWithOverridesFromObject
108
{
119
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ namespace Mono.Linker.Tests.Cases.CoreLink
1414
// we known should be removed which will at least verify that the core library was processed
1515
[RemovedMemberInAssembly (PlatformAssemblies.CoreLib, typeof (Stack), ".ctor(System.Collections.ICollection)")]
1616

17-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
18-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
1917
class LinkingOfCoreLibrariesRemovesUnusedMethods
2018
{
2119
public static void Main ()

src/tools/illink/test/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@ namespace Mono.Linker.Tests.Cases.CoreLink
1717
[KeptAssembly ("System.dll")]
1818
[KeptTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedList<,>))]
1919
[RemovedTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedDictionary<,>))]
20-
21-
// Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168
22-
[SkipPeVerify (SkipPeVerifyForToolchian.Pedump)]
23-
24-
// All sorts of stuff is flagged as invalid even in the original System.dll and System.Configuration.dll for mono class libraries
25-
[SkipPeVerify ("System.dll")]
26-
[SkipPeVerify ("System.Configuration.dll")]
27-
// System.Core.dll is referenced by System.dll in the .NET FW class libraries. Our GetType reflection marking code
28-
// detects a GetType("SHA256CryptoServiceProvider") in System.dll, which then causes a type in System.Core.dll to be marked.
29-
// PeVerify fails on the original GAC copy of System.Core.dll so it's expected that it will also fail on the stripped version we output
30-
[SkipPeVerify ("System.Core.dll")]
3120
class LinkingOfCoreLibrariesRemovesUnusedTypes
3221
{
3322
public static void Main ()

0 commit comments

Comments
 (0)