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

[Feature Request] Add ability to limit types compiled into reference assemblies #36409

Open
rladuca opened this issue Jun 13, 2019 · 4 comments
Labels
Area-Compilers Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request InternalAsk User Story A single user-facing feature. Can be grouped under an epic.
Milestone

Comments

@rladuca
Copy link
Member

rladuca commented Jun 13, 2019

WPF makes extensive use of InternalsVisibleTo in its own builds. However, we don't want these items to show up in reference assemblies. This is because we don't ship a reference assembly for every runtime assembly and the internal surface area generates dangling references to these intentionally excluded assemblies.

We'd like some way of configuring the output of types into a reference assembly, perhaps akin to what GenAPI does with exclusion/inclusion files. At the very least, we'd like to be able to turn off the inclusion of internal surface area via some compiler switch/msbuild property.

Related to dotnet/wpf#932.

@tannergooding
Copy link
Member

CC. @ericstj

@rladuca
Copy link
Member Author

rladuca commented Jun 13, 2019

CC. @vatsan-madhavan

@gafter gafter added this to the Compiler.Next milestone Jul 9, 2019
@gafter gafter added the Concept-API This issue involves adding, removing, clarification, or modification of an API. label Jul 9, 2019
@ericstj
Copy link
Member

ericstj commented Jul 30, 2020

I did some initial investigation and found that the IL Linker can actually handle reference assemblies and does a decent job at trimming. I used the same settings for the linker we use in dotnet/runtime to trim our runtime assemblies. I was able to compare the handcrafted reference assembly for System.Text.Json (25 KB), the roslyn generated one (75 KB), and the trimmed version (25 KB). Using the Linker we were able to get size similar to our custom tools, and Roslyn+Linker did a better job at preserving relevant internals (fields in structs, usage of generic parameters, etc).

@jmarolf jmarolf added the User Story A single user-facing feature. Can be grouped under an epic. label Dec 2, 2021
@jaredpar jaredpar modified the milestones: Compiler.Next, Backlog Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Concept-API This issue involves adding, removing, clarification, or modification of an API. Feature Request InternalAsk User Story A single user-facing feature. Can be grouped under an epic.
Projects
None yet
Development

No branches or pull requests

8 participants