Make DependencyInjection more linker trimmable by eerhardt · Pull Request #38729 · dotnet/runtime (original) (raw)

Allow the unused ServiceProviderEngine strategy types to be trimmed by the ILLinker by removing the ServiceProviderMode enum and only have the "default" behavior in the product. The ServiceProviderMode enum is only used for testing, so move it to the tests.

Fix #38678

This allows for System.Linq.Expressions to be completely removed in a default Blazor application. It also removes one of two usages of System.Reflection.Emit (the other being #38693).

With this change, the IL size of a Blazor WASM default template application:

Build Size
master 3,366,912 bytes
PR 3,039,232 bytes