Skip to content

Avoid scanning all references for DynamicInterfaceCastableImplementation #1788

@sbomer

Description

@sbomer

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions