Skip to content

Add support for abstract static interface members #2058

@agocke

Description

@agocke

The linker shouldn't trim the interface definition when trimming in library mode, and we likely need to support the same implementation checks that we do for other interface members.

The minimum bar for .NET 6 is to ensure that runtime libraries are trim safe with this feature. The following check list tracks the tasks that are needed for the full support of this feature

  • Trimmer support for the IL changes. Specifically, the trimmer matches the runtime changes.
  • The runtime tests can be found here which contains tests in IL for TypeHierarchy, GenericContext, InterfaceVariance, and negative tests.
  • Add C# tests to the trimmer that tests this feature comprehensively (will require an updated compiler with the static interface support enabled)
  • Reflection support, specifically MakeGenericType and MakeGenericMethod.
  • Trimmer annotations are correctly propagated.
    • Validate DAM on type implementing static interface, or on interface type itself keeps interface members
    • Validate DAM on generic in interface method signature, or on interface type gets applied
    • Validate matching of DAM/RUC on interface method and implementing overrides
  • [ ] Investigate trimming of static interface methods when the interface is not used #2733 - potential improvement as this could reduce size

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions