dotnet / dotnet/linker

Avoid scanning all references for DynamicInterfaceCastableImplementation

Open
#1,788 1 comment 0 reactions 0 assignees View on GitHub
area-Linker: Steps
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

We currently scan all references for interfaces with `DynamicInterfaceCastableImplementationAttribute`, and keep any that implement marked interfaces. This attribute was designed to make the `IDynamicCastableInterface` feature linker-friendly, by explicitly annotating types that can serve as interface implementations for dynamic casts.

Depending on the expected behavior of `GetInterfaceImplementation`, we may be able to avoid this scan. There are already cases where we would not mark the attributed implementation (when `GetInterfaceImplementation` does non-analyzable reflection to get the implementing type's assembly, and that assembly isn't statically referenced).

However, we currently still scan *referenced* assemblies and keep such types (even if they are only used by non-analyzable reflection). Would it be safe to remove the attributed interfaces in this case? The linker already issues a warning for this.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.