diff options
author | Sven Boemer <sbomer@gmail.com> | 2019-04-09 11:11:56 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-04-09 11:11:56 +0300 |
commit | 744804f0a48fe92ebad54eff7d581c9d4af7860d (patch) | |
tree | 622fd62c54425400b6b5a2561ed4710b8a0b99ce /src | |
parent | 529969e9f08d49049f550930445f9dab0f2fc801 (diff) |
Fix attribute sweep bug and enable more tests on .NET Core (#520)
The introduction of `MethodWithoutParameters()` in this test causes the linker to write invalid IL. When the linker sweeps this method, a bug causes it to keep the attribute on the return type parameter. However, the attribute type itself is removed (causing it to become detached from its declaring type).
https://jenkins.mono-project.com/job/test-linker-pull-request/759/console:
```
09:58:19 1) Failed : Mono.Linker.Tests.TestCases.All.OnlyKeepUsed.UnusedAttributeOnReturnTypeIsRemoved
09:58:19 Invalid IL detected in /tmp/linker_tests/output/library.dll
09:58:19 FAIL: Invalid CustomAttribute row 0 Type field 0x00000022
09:58:19 Error count: 1
09:58:19 at Mono.Linker.Tests.TestCasesRunner.PeVerifier.CheckAssembly (Mono.Linker.Tests.Extensions.NPath assemblyPath) [0x00099] in <0aac952fa2cb4e07af00f27b39783fd3>:0
09:58:19 at Mono.Linker.Tests.TestCasesRunner.PeVerifier.Check (Mono.Linker.Tests.TestCasesRunner.LinkedTestCaseResult linkResult, Mono.Cecil.AssemblyDefinition original) [0x00098] in <0aac952fa2cb4e07af00f27b39783fd3>:0
09:58:19 at Mono.Linker.Tests.TestCasesRunner.ResultChecker.Check (Mono.Linker.Tests.TestCasesRunner.LinkedTestCaseResult linkResult) [0x00095] in <0aac952fa2cb4e07af00f27b39783fd3>:0
09:58:19 at Mono.Linker.Tests.TestCases.All.Run (Mono.Linker.Tests.TestCases.TestCase testCase) [0x00019] in <0aac952fa2cb4e07af00f27b39783fd3>:0
09:58:19 at Mono.Linker.Tests.TestCases.All.AttributesTests (Mono.Linker.Tests.TestCases.TestCase testCase) [0x00001] in <0aac952fa2cb4e07af00f27b39783fd3>:0
```
Diffstat (limited to 'src')
-rw-r--r-- | src/linker/Linker.Steps/SweepStep.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/linker/Linker.Steps/SweepStep.cs b/src/linker/Linker.Steps/SweepStep.cs index 224a33ae6..e24f87486 100644 --- a/src/linker/Linker.Steps/SweepStep.cs +++ b/src/linker/Linker.Steps/SweepStep.cs @@ -398,13 +398,13 @@ namespace Mono.Linker.Steps { SweepDebugInfo (methods); foreach (var method in methods) { + SweepCustomAttributes (method.MethodReturnType); + if (!method.HasParameters) continue; foreach (var parameter in method.Parameters) SweepCustomAttributes (parameter); - - SweepCustomAttributes (method.MethodReturnType); } } |