dotnet / dotnet/linker

Add a feature that prevents types that inherit from specific types or interfaces from being trimmed

Open
#1,806 7 comments 0 reactions 1 assignee Claimed by @vitek-karas View on GitHub
proposal
Dominant language
C#
Stars
392
Forks
128
Avg merge
2d 10h
Merged PRs (30d)
2

Description

A common pattern in ASP.NET Core is to have well known types or interfaces such as `IComponent`, `Controller` or `Hub`, that a user derives from and the framework reflects over. For e.g.

```C#
void SetProperties(IComponent component, IDictionary values)
{
var properties = component.GetType().GetProperties(...);
SetValues(properties, values);
}

InvokeController(Controller controller, string method)
{
controller.GetMethod(method).Invoke();
}
```

In the component case, having the ability to have type level trimming would help - if the type is referenced, always preserve it's members. In the event of a Controller or a Hub, we want the ability to say always preserve any types that derive from these types since they're primarily discovered and accessed via reflection.

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.