-
Notifications
You must be signed in to change notification settings - Fork 128
Preserve all interfaces in library mode #2886
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
Conversation
vitek-karas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - but @sbomer should take a look since he knows this better 😉
To fix that issue, it would be sufficient to limit this to instance virtual methods (or even instance abstract, since COM doesn't work with default interface methods). But "all interface methods" will work too. |
| Annotations.SetPreserve (type, TypePreserve.All); | ||
| } | ||
| break; | ||
| default: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing down what we discussed:
I think for public interfaces we will hit the default case, and SetMembersPreserve (type, preserve) won't preserve all interface members. We should either consistently use TypePreserve.All for the interface members, or use the TypePreserveMembers to preserve only the specified interface members.
sbomer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
|
For reference, this change adds 17280 bytes to the shared framework after trimming on Linux-x64-Release 81065987 on main |
Commit migrated from dotnet/linker@e2b3a92
Annotate all interfaces as fully preserved when an assembly in in library mode. This will keep all interfaces and all interface methods in library mode regardless of visibility or use.
Fixes #2881