Skip to content

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

@pranavkm

Description

@pranavkm

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.

void SetProperties(IComponent component, IDictionary<string, object> 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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions