Skip to content

ILLink should error out when failing to resolve assemblies/types/members #103831

@sbomer

Description

@sbomer

Currently ILLink has a relaxed default that makes a best-effort attempt to continue when it fails to resolve assemblies/types/members. This leads to bugs like #93797. We should consider making the resolution behavior stricter.

Historically, the relaxed behavior (--skip-unresolved true) was useful in combination with assembly-level trimming:

  • Shims like mscorlib.dll often had dangling type forwarders
  • We would sometimes encounter apps where some unused code path had a dangling type reference

When using aggressive trimming, I don't see any good reason for the relaxed behavior (--skip-unresolved true).

I propose we make the following changes:

  1. Make the relaxed mode (--skip-unresolved true) strict for everything but type forwarders.
  2. Change the default to be strict (--skip-unresolved false) when using TrimMode=link

I would make the change early in .NET 10 to give us time to respond to breaks. #91007 has additional context describing Unity's use of these options.

@vitek-karas @MichalStrehovsky @dotnet/illink

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions