Skip to content

Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only#125365

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/simplify-illink-assembly-handling
Draft

Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only#125365
Copilot wants to merge 3 commits intomainfrom
copilot/simplify-illink-assembly-handling

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

TrimmerRootAssembly items and the illink -a flag previously accepted file paths, creating an MSBuild incremental build gap: illink could read files not declared as build inputs. This aligns both ILLink and ILC to accept only assembly names.

Description

ILLink command-line (-a flag)

  • Driver.cs: Remove File.Exists() pre-check; -a now accepts assembly names only
  • RootAssemblyInputStep.cs: Remove File.Exists() loading path ("quirks mode"); rename LoadAssemblyFile()LoadAssemblyByName(), resolve exclusively via Context.TryResolve()

MSBuild targets

  • Microsoft.NET.ILLink.targets: Populate TrimmerRootAssembly with @(IntermediateAssembly->'%(Filename)') (name, no extension) instead of the full item path
  • Microsoft.NETCore.Native.targets: Remove complex two-step _Raw + System.IO.File::Exists() pattern that converted paths to names; TrimmerRootAssembly is now used directly as assembly names; ManagedAssemblyToLink still uses %(Filename) since it contains file paths
  • BrowserWasmApp.targets: Update condition to compare %(Identity) against $(AssemblyName) instead of @(IntermediateAssembly)
  • AppleBuild.LocalBuild.targets: Use %(AppleAssembliesToBundle.FileName) (no extension) instead of %(Identity) (full path)

Test infrastructure

  • TrimmingArgumentBuilder.cs: Strip extension via Path.GetFileNameWithoutExtension() when building -a arguments
  • TestCaseMetadataProvider.cs: Move relative-path expansion from -a to -d (search directory arguments); -a values are now passed through as-is
  • Update 21 test cases to use assembly names without extensions in [SetupLinkerArgument("-a", ...)]
  • RootLibraryVisibleForwardersWithoutReference.cs: Add explicit [SetupLinkerArgument("-d", "isolated")] search path so the subdirectory assembly remains findable by name

Customer Impact

No direct customer impact; this is an internal build/tooling correctness fix. Users who were passing file paths to TrimmerRootAssembly (undocumented usage) will need to switch to assembly names.

Regression

No — this is a proactive correctness fix, not a regression fix.

Testing

All 377 affected ILLink test cases pass (Mono.Linker.Tests). All 108 ILLink.Tasks.Tests pass.

Risk

Low. The change is contained to ILLink/ILC build integration and test infrastructure. The linker's assembly resolution behavior is unchanged — only the file-path loading shortcut is removed. MSBuild targets now pass assembly names consistently, which is what downstream tools (ILC) already required.

Package authoring no longer needed in .NET 9

IMPORTANT: Starting with .NET 9, you no longer need to edit a NuGet package's csproj to enable building and bump the version.
Keep in mind that we still need package authoring in .NET 8 and older versions.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…nly support assembly names

Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service bot added the linkable-framework Issues associated with delivering a linker friendly framework label Mar 10, 2026
Copilot AI changed the title [WIP] Simplify illink root assembly handling to support assembly names only Simplify illink root assembly handling: TrimmerRootAssembly assembly names only Mar 10, 2026
… names only

Co-authored-by: sbomer <787361+sbomer@users.noreply.github.com>
Copilot AI changed the title Simplify illink root assembly handling: TrimmerRootAssembly assembly names only Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-AssemblyLoader-coreclr linkable-framework Issues associated with delivering a linker friendly framework

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants