dotnet / dotnet/linker

Investigate trimming of static interface methods when the interface is not used

Open
#2,733 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

Currently linker will keep the interface if there's a method which implements one of the static interface methods on it and that implementation method is kept. This is unlike non-static interface methods where the same situation still allows the linker to remove the interface.

Sample:
```C#
void Main()
{
TestClass.Method (); // Use the implementation method only
}

[Kept] // ??? Why
interface IStaticIFace
{
[Kept] // ??? Why
static abstract Method();
}

[Kept] // This is correct
class TestClass : IStaticIFace
{
[Kept] // This is correct
public static abstract Method() {};
}
```

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.