Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Improve test failure message when a fatal linker error exception happens - #2331

Merged
marek-safar merged 1 commit into
dotnet:mainfrom
Unity-Technologies:master-improve-error-when-fatal-linker-exception
Nov 3, 2021
Merged

marek-safar merged 1 commit into
dotnet:mainfrom
Unity-Technologies:master-improve-error-when-fatal-linker-exception

Conversation

@mrvoorhe

Copy link
Copy Markdown
Contributor

When a test hits a LinkerFatalErrorException the test will fail with the following error

The linked output assembly was not found.  Expected at C:\Unity\dev\unity-monolinker-2\artifacts\testcases\illink\Attributes\GenericEnumInAttribute\...

  The linked output assembly was not found.  Expected at C:\Unity\dev\unity-monolinker-2\artifacts\testcases\illink\Attributes\GenericEnumInAttribute\output\test.exe
  Expected: True
  But was:  False

This is not helpful and is very confusing.

Instead, when running tests, rethrow the LinkerFatalErrorException so that the tests correctly report an error. Ex:

Mono.Linker.LinkerFatalErrorException : ILLink: error IL1005: Mono.Linker.Tests.Cases.Attributes.GenericEnumInAttribute.Main(): Error processing method 'Mono.Linker.Tests.Cases.Attributes.GenericEnumInAttribute.Method()' in assembly 'test.exe'
  ----> System.NotImplementedException : GenericInst
   at Mono.Linker.Steps.MarkStep.ProcessQueue() in C:\Unity\dev\unity-monolinker-2\src\linker\Linker.Steps\MarkStep.cs:line 515

@mrvoorhe
mrvoorhe requested a review from marek-safar as a code owner October 26, 2021 13:05
When a test hits a `LinkerFatalErrorException` the test will fail with the following error
```
The linked output assembly was not found.  Expected at C:\Unity\dev\unity-monolinker-2\artifacts\testcases\illink\Attributes\GenericEnumInAttribute\...

  The linked output assembly was not found.  Expected at C:\Unity\dev\unity-monolinker-2\artifacts\testcases\illink\Attributes\GenericEnumInAttribute\output\test.exe
  Expected: True
  But was:  False
```

This is not helpful and is very confusing.

Instead, when running tests, rethrow the `LinkerFatalErrorException` so that the tests correctly report an error.  Ex:
```
Mono.Linker.LinkerFatalErrorException : ILLink: error IL1005: Mono.Linker.Tests.Cases.Attributes.GenericEnumInAttribute.Main(): Error processing method 'Mono.Linker.Tests.Cases.Attributes.GenericEnumInAttribute.Method()' in assembly 'test.exe'
  ----> System.NotImplementedException : GenericInst
   at Mono.Linker.Steps.MarkStep.ProcessQueue() in C:\Unity\dev\unity-monolinker-2\src\linker\Linker.Steps\MarkStep.cs:line 515
```
@mrvoorhe
mrvoorhe force-pushed the master-improve-error-when-fatal-linker-exception branch from 15a39bb to 40ae985 Compare October 26, 2021 13:06
@marek-safar
marek-safar merged commit e884052 into dotnet:main Nov 3, 2021
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants