Skip to content

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

Closed

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

Activity

  1. added
    untriaged
    on Mar 28, 2026
  2. dotnet-policy-service commented on Mar 28, 2026

    @dotnet-policy-service
    Contributor

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

  3. added
    area-Tools-ILLink
    and removed
    area-AssemblyLoader-coreclr
    on Mar 28, 2026
  4. dotnet-policy-service commented on Mar 28, 2026

    @dotnet-policy-service
    Contributor

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

  5. wtgodbe commented on Mar 29, 2026

    @wtgodbe
    Member

    Add explicit -d arguments in the shared fx build targets

    I tried this in dotnet/aspnetcore@ca50ef4 without any luck. I tried a bunch of different approaches to get the assemblies passed to ILLink but nothing seemed to work.

  6. added this to the 11.0.0 milestone on Mar 30, 2026
  7. removed
    untriaged
    on Mar 30, 2026
  8. sbomer commented on Mar 30, 2026

    @sbomer
    Member

    The RootAssemblyNames was designed from the start and documented as taking assembly names, not paths. This change was necessary to fix an incremental build issue - any consumers should ensure they are passing assembly names, not paths, to this input.

    making ILLink resolve root assemblies exclusively via Context.TryResolve() (name-based resolution using -d search directories).

    The full paths need to be passed as AssemblyPaths which will allow them to be resolved. -d is not documented or supported and should not be used. Looks like @wtgodbe fixed this in aspnetcore already and I think it's no longer blocked on this. I pushed a fix to the sdk codeflow as well.

    I'm going to close this but feel free to re-open if you think there's more that needs to be done here. Also happy to help if there are more code flow issues.

  9. locked and limited conversation to collaborators on Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink

Type

No type

Projects

  • Status
    No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions