Preserve all interfaces in library mode#2886
Conversation
vitek-karas
left a comment
There was a problem hiding this comment.
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.
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.
|
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