Skip to content
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

Define behavior of AssemblyMetadata("IsTrimmable", "False") #2991

Open
sbomer opened this issue Aug 22, 2022 · 2 comments
Open

Define behavior of AssemblyMetadata("IsTrimmable", "False") #2991

sbomer opened this issue Aug 22, 2022 · 2 comments
Milestone

Comments

@sbomer
Copy link
Member

sbomer commented Aug 22, 2022

We considered supporting [AssemblyMetadata("IsTrimmable", "False")], but decided against it at the time because overuse of this attribute would potentially prevent trimming in situations where only a trim-friendly part of a library is used. Now that the trimming defaults have changed to trim-by-default, we might want to reconsider.

We also changed the MSBuild logic so that setting MSBuild metadata <IsTrimmable>false</IsTrimmable> on an individual assembly (in the ManagedAssemblyToLink itemgroup) would give it the copy action - see #2856 (comment).

Personally I still don't see much value in this, but I opened this to track the discussion since it came up in Azure/azure-sdk-for-net#24238.

@MichalStrehovsky
Copy link
Member

It would be good to have a motivating use case for this. I'm having a hard time coming up with an example of a scenario where library is reflecting on itself in an unpredictable way (the Azure issue doesn't seem to actually have one either).

The more typical scenario for trimming unfriendly code is libraries that reflect on code outside of their own assembly because they cannot reference it statically (think: Newtonsoft, Autofac). Such attribute wouldn't be useful for them, unless it disables trimming for the whole app. We probably don't want to give libraries such power.

@marek-safar
Copy link
Contributor

#3083 could be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants