Clean up SkipUnresolved handling in linker test framework.#124972
Merged
sbomer merged 1 commit intodotnet:mainfrom Mar 2, 2026
Merged
Clean up SkipUnresolved handling in linker test framework.#124972sbomer merged 1 commit intodotnet:mainfrom
SkipUnresolved handling in linker test framework.#124972sbomer merged 1 commit intodotnet:mainfrom
Conversation
* The default value of `SkipUnresolved` in the test framework was false. This doesn't align with the default value used by ILLink itself which is true. * When `SkipUnresolved` was false, `AddSkipUnresolved` would do nothing. This meant that tests that explicitly try to use false wouldn't actually run with SkipUnresolved=False. Instead the linker would run with it's default value of `true`. * Switch SkipUnresolved tests to use the attribute. Using the attribute ensures that we either get the default value or the value the test requested.
Contributor
Author
|
@sbomer please take a look |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/illink |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the ILLink linker test framework to make SkipUnresolved handling consistent with ILLink’s own default (true) and ensures tests that request SkipUnresolved=false actually run with that value.
Changes:
- Change the test framework default for
SkipUnresolvedtotrueto match ILLink. - Always emit
--skip-unresolved <bool>in the generated linker arguments sofalseis honored. - Migrate affected test cases from raw
SetupLinkerArgument("--skip-unresolved", ...)usage to the dedicated[SkipUnresolved(...)]attribute.
Reviewed changes
Copilot reviewed 58 out of 58 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs | Always emits --skip-unresolved with an explicit boolean value. |
| src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseMetadataProvider.cs | Changes default SkipUnresolved option to true. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/UnreachableBody/LinkedOtherIncludedLibraryNoInstanceCtor.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/UnreachableBody/DoesNotApplyToCopiedAssembly2.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/UnreachableBlock/UninitializedLocals.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/UnreachableBlock/EndScopeOnMethoEnd.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwardersRewrite.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwardersModifiers.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/TypeForwarding/SecurityAttributeScope.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/ILVerificationWorks.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/ILVerificationErrorsCanBeIgnored.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypesWithMdbAndSymbolLinkingEnabled.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypesAndSymbolLinkingEnabled.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferencesWithMixedSymbolTypes.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteActionAndSymbolLinkingEnabled.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbDeleteAction.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbCopyAction.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndNewMvid.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabledAndDeterministicMvid.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdbAndSymbolLinkingEnabled.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithPdb.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteActionAndSymbolLinkingEnabled.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbDeleteAction.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdbCopyAction.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Symbols/ReferenceWithMdb.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/References/MissingReferenceInUsedCodePath.cs | Uses [SkipUnresolved(false)] to ensure the test runs with skipping disabled. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/References/MissingReferenceInUnusedCodePath.cs | Uses [SkipUnresolved(false)] to ensure the test runs with skipping disabled. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/PreserveDependencies/PreserveDependencyErrorCases.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/LinkXml/LinkXmlErrorCases.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/LinkAttributes/LinkAttributeErrorCases.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Libraries/LibraryWithUnresolvedInterfaces.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/StaticInterfaceMethods/InstanceMethodsWithOverridesSwept.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/RecursiveInterfaces/OverrideOfRecursiveInterfaceIsRemoved.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/RecursiveInterfaces/InterfaceImplementedRecursively.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/RecursiveInterfaces/GenericInterfaceImplementedRecursively.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveNone.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethods.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFields.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveAll.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndAssemblyPreserveAll.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/InterfaceImplementedThroughBaseInterface.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/StaticDimProvidedByUnreferencedIfaceInHierarchy.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/MultipleDimsProvidedByRecursiveInterface.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/InterfaceWithAttributeOnImplementation.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/DefaultInterfaceMethods/DimProvidedByRecursiveInterface.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/DynamicDependencies/DynamicDependencyMethodInAssembly.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/CppCLI/NonCopyActionWarnOnCppCLI.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/CppCLI/CppCLIAssemblyIsAnalyzed.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/ComponentModel/CustomTypeConvertor.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnGenericParameterIsRemoved.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/IVTUsed.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
| src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/CoreLibraryAssemblyAttributesAreKept.cs | Uses [SkipUnresolved(true)] instead of raw linker argument. |
Comments suppressed due to low confidence (1)
src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TrimmingArgumentBuilder.cs:126
AddSkipUnresolvedappendsskipUnresolved.ToString()which producesTrue/False(capitalized). The rest of this builder uses lowercase"true"/"false"strings for boolean options, and downstream consumers may rely on that consistency. Consider emitting lowercase explicitly (e.g.,skipUnresolved ? "true" : "false"orToString().ToLowerInvariant()).
This was referenced Feb 27, 2026
sbomer
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The default value of
SkipUnresolvedin the test framework was false. This doesn't align with the default value used by ILLink itself which is true.When
SkipUnresolvedwas false,AddSkipUnresolvedwould do nothing. This meant that tests that explicitly try to use false wouldn't actually run with SkipUnresolved=False. Instead the linker would run with it's default value oftrue.Switch SkipUnresolved tests to use the attribute. Using the attribute ensures that we either get the default value or the value the test requested.