ILLinkTrim.Descriptors.xml saying to keep the type in entirety
Command line argument to illink saying to keep the entire assembly that contains the type
All of the above tell analysis that someone is going to access potentially everything on this type without analysis seeing it. They may use reflection invoke. They may use hosting APIs. But the analysis has no visibility into the values set/passed. It keeps the members so that someone can do arbitrary things with them at runtime.
I like the idea to treat descriptors/arguments as keeping things for reflection. If someone is going out of their way to preserve things we should assume the worst. This would also encourage people to turn on more aggressive trimming (since they might otherwise get more warnings from unused parts of the rooted assemblies).
I do agree with descriptors and similar to trigger reflection dependency. We should fix that currently. That said I know that there were some cases in the past where we decided we should NOT warn on RUC if the reference is coming from a descriptor. Maybe we should revisit that again.
As for "copy" assemblies, maybe those should not warn, but it's not a big deal I think. We should have single-warn on by default and so typically one should get a single warning from the entire assembly.
@MichalStrehovsky in https://github.com/dotnet/linker/pull/2792#issuecomment-1137977247:
@sbomer in https://github.com/dotnet/linker/pull/2792#issuecomment-1138012830:
@MichalStrehovsky in https://github.com/dotnet/linker/pull/2792#issuecomment-1138043846:
@vitek-karas in https://github.com/dotnet/linker/pull/2792#issuecomment-1139679207: