Skip to content

Trimmer removes InternalsVisibleTo attributes for assemblies which are trimmed #92582

Closed
@vitek-karas

Description

@vitek-karas

Trimmer has special code to handle InternalsVisibleToAttribute. Specifically, it tries to remove those attribute instances which point to assemblies which either can't be resolved, or which are not kept in the app after trimming.

https://github.com/dotnet/runtime/blob/main/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs#L295-L307

This creates an observable difference in behavior between trimmed and non-trimmed apps without getting a trim analysis warning. The app can use reflection to inspect the InternalsVisibleTo attributes and it will see a different set after trimming.

The trimmer should preserve all InternalsVisibleTo attributes, the size savings are very small.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzersin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions