-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
The default TrimMode for ILLink is copyused, which will keep an entire assembly if it is statically used. The primary advantage of copyused over link is that it keeps more code, making it more likely that the linked application will work. But this has a few downsides:
- We keep code which is unused by the application, bloating app size
- This can produce spurious warnings from unused code
- We don't rewrite IL in
copyusedassemblies, so we don't eliminate unused branches- This results in spurious warnings from unused features
- This may also compound the size problem - we might keep dependencies (possibly other assemblies) of branches that would otherwise have been eliminated
We should consider changing the default mode to link - this mode has proven to work well enough for Xamarin and Blazor. The downside is that we have shipped the last two releases (albeit in "preview") with copyused as the default, and changing it could break some apps, particularly in cases where non-framework code reflects over the framework.