-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library trimming steps should support feature switch substitutions #95429
Comments
Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas Issue DetailsOur recommended way to get all warnings from a library is to use a sample app that references the library with the 'copy' action, as described in https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming Unfortunately, it doesn't seem like feature switches work as expected in this scenario. Specifically, the properties don't get replaced and the warnings don't get suppressed.
|
To fix this I think |
The current behavior causes us to unnecessarily root facade assemblies (System.Runtime, netstandard, etc.) because we're not allowed to rewrite typeforwards to their definition in assemblies rooted with TrimmerRootAssembly. I think making this change would be overall goodness. I assume our C++/CLI logic doesn't depend on
Trying to think about where this would break, the only scenario I can think about is if this was an assembly full of type forwards - we should make sure type forwards are also kept. Looks like people like to
Would setting the |
If I understand this correctly - we will still root everything in the assembly, so the only changes are:
These all sound relatively minor. I agree we should give this a try - if we merge this into 9 relatively soon, we should have a long window of validation. |
I think TrimmerRootAssembly should assume everything is a reflection target (otherwise why root it?) so I'd not expect that one to happen. |
That's a good point - and it should work that way already. |
Good point, we already have an escape hatch, even if it's not as simple as setting some boolean flag. Sounds good to me! |
Our recommended way to get all warnings from a library is to use a sample app that references the library with the 'copy' action, as described in https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming
Unfortunately, it doesn't seem like feature switches work as expected in this scenario. Specifically, the properties don't get replaced and the warnings don't get suppressed.
The text was updated successfully, but these errors were encountered: