Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature request: trim single assembly from app #2609

Open
agocke opened this issue Feb 14, 2022 · 1 comment
Open

Feature request: trim single assembly from app #2609

agocke opened this issue Feb 14, 2022 · 1 comment

Comments

@agocke
Copy link
Member

agocke commented Feb 14, 2022

The idea here is to allow the linker to run and trim nothing except for certain assemblies that have opted-in to being always trimmed.

@agocke agocke added this to the Future milestone Feb 17, 2022
@agocke
Copy link
Member Author

agocke commented Feb 17, 2022

Right now, the problem with this feature is primarily because of reflection. First, if there are any trim warnings anywhere in the app, the trimmer cannot guarantee that such usage is safe. In addition, to scan for usage by reflection, every line in every library in the app would have to be scanned, just in case reflection is used against the target library. This could be very slow, and while that may be acceptable for trimming a whole app, trimming just one or two libraries in the app would make this unacceptable.

In order to make this safe, reflection would have to be disallowed against the target library. Unfortunately, because many serializers in the ecosystem use reflection, this would prohibit using any types from the library in any serializer, or often loggers, anywhere in the app.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant