镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Treat path-shaped assembly-name strings as unresolved in ILLink - #136249

Merged
sbomer merged 2 commits into
mainfrom
sbomer/illink-reject-path-shaped-resolution
Oct 22, 2026
Merged

sbomer merged 2 commits into
mainfrom
sbomer/illink-reject-path-shaped-resolution

Conversation

@sbomer

@sbomer sbomer commented Oct 21, 2026

Copy link
Copy Markdown
Member

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.

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
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 21, 2026
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Oct 21, 2026
@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/illink
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
@sbomer
sbomer added this pull request to stack #136310 October 22, 2026 17:49
@sbomer
sbomer merged commit 598d884 into main Oct 22, 2026
93 checks passed
@sbomer
sbomer deleted the sbomer/illink-reject-path-shaped-resolution branch October 22, 2026 20:57
@github-project-automation github-project-automation Bot moved this to Done in AppModel Oct 22, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 23, 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants