Repository navigation
Treat path-shaped assembly-name strings as unresolved in ILLink - #136249
Merged
Merged
Conversation
Preserve ordinary unresolved diagnostics and tolerant reflection probing while keeping explicit reference file paths supported. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58eb5972-179d-44fb-8b71-3632cb35ab0c
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/illink |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Source inspection confirms that the new absolute-path reflection tests fail on Windows before exercising assembly resolution; no builds or tests were run during this review.
1 open issue
What changed in this PR
This PR prevents ILLink’s string-based assembly lookup from treating assembly names as file paths, while preserving explicit-path loading and existing unresolved diagnostics.
Changes:
- Centralizes assembly-name validation and applies it to string-based lookup callers.
- Preserves explicit reference handling and resolution precedence.
- Adds regression tests for path rejection, diagnostics, caching, and valid inputs.
| File | Description |
|---|---|
| src/tools/illink/test/Mono.Linker.Tests/Tests/AssemblyResolverTests.cs | Adds resolver regression coverage. |
| src/tools/illink/src/linker/Linker/TypeMapHandler.cs | Validates forwarded assembly-name strings. |
| src/tools/illink/src/linker/Linker/LinkContext.cs | Adds shared validation and guarded parsing. |
| src/tools/illink/src/linker/Linker/Driver.cs | Reuses validation for command-line assembly names. |
| src/tools/illink/src/linker/Linker/AssemblyResolver.cs | Preserves explicit-reference lookup and unresolved reporting. |
| src/tools/illink/src/linker/Linker.Steps/ProcessReferencesStep.cs | Uses the explicit-reference resolution path. |
| src/tools/illink/src/linker/Linker.Steps/ProcessLinkerXmlBase.cs | Handles rejected XML assembly names through existing warnings. |
| src/tools/illink/src/linker/Linker.Steps/MarkStep.cs | Validates type-map entry assembly names before resolution. |
| src/tools/illink/src/linker/Linker.Steps/LinkAttributesParser.cs | Validates attribute assembly names before resolution. |
Review effort: Balanced
Use literal rooted reflection names and retain relative-path file probes without platform-specific test exclusions. Assisted-by: Copilot:gpt-6.1-sol Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58eb5972-179d-44fb-8b71-3632cb35ab0c
agocke
approved these changes
Oct 22, 2026
sbomer
added a commit
that referenced
this pull request
Oct 23, 2026
) Treat path-shaped assembly-name strings as unresolved before constructing assembly-name references or consulting the loaded cache. This prevents name-based lookup from probing parent directories or other paths while preserving each caller's existing unresolved diagnostics and tolerant reflection probing. Explicit reference file paths and already-created assembly-name references retain their current behavior. Linux validation passed: 1,317 ILLink tests (including 175 focused resolver cases), 212 task tests, 33 cache-tool tests, and 1,135 analyzer tests, with 39 existing skips and no failures. ILTrim also builds successfully. Windows/macOS and the ILC/ILTrim test suites were not run. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 58eb5972-179d-44fb-8b71-3632cb35ab0c (cherry picked from commit 598d884)
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.

Treat path-shaped assembly-name strings as unresolved before constructing assembly-name references or consulting the loaded cache. This prevents name-based lookup from probing parent directories or other paths while preserving each caller's existing unresolved diagnostics and tolerant reflection probing. Explicit reference file paths and already-created assembly-name references retain their current behavior.
Linux validation passed: 1,317 ILLink tests (including 175 focused resolver cases), 212 task tests, 33 cache-tool tests, and 1,135 analyzer tests, with 39 existing skips and no failures. ILTrim also builds successfully. Windows/macOS and the ILC/ILTrim test suites were not run.
Note
This content was created with assistance from AI.