Skip to content

ILLink IL1032 regression: root assembly name resolution fails for shared framework build after #125365 #126268

@lewing

Description

@lewing

Description

PR #125365 ("Simplify ILLink/ILC root assembly handling: TrimmerRootAssembly assembly names only") removed the File.Exists() fallback from RootAssemblyInputStep.LoadAssemblyByName(), making ILLink resolve root assemblies exclusively via Context.TryResolve() (name-based resolution using -d search directories).

This breaks the aspnetcore shared framework build, which passes assembly names (not paths) to TrimmerRootAssembly, but the assemblies can't be resolved because the search directories don't cover all output paths:

ILLink : error IL1032: Root assembly with name 'Microsoft.AspNetCore.Authorization' could not be found.
ILLink : error IL1032: Root assembly with name 'Microsoft.AspNetCore.Components' could not be found.

This is blocking:

Root Cause

The old code in RootAssemblyInputStep had a File.Exists() check that would load assemblies directly from a file path. The new code only does:

var assembly = Context.TryResolve(assemblyName);

TryResolve depends on -d search directory arguments. The aspnetcore shared fx build doesn't have all assembly output directories in the search path, so ILLink can't find them by name alone.

Options

  1. Fix search directories — Update Microsoft.NET.ILLink.targets to include all ResolvedFileToPublish directories as -d arguments
  2. Restore fallback — Add File.Exists() fallback in LoadAssemblyByName() for backward compatibility (but this partially reverts the incremental build fix)
  3. Fix aspnetcore build — Add explicit -d arguments in the shared fx build targets

cc @sbomer @wtgodbe @lewing

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions