Microsoft.Extensions.Configuration.Binder is not linker-safe #40551
Labels
area-Extensions-Configuration
blocked
Issue/PR is blocked on something - see comments
linkable-framework
Issues associated with delivering a linker friendly framework
Milestone
Description
The
ConfigurationBinder
class will recursively create objects and set properties based on anIConfiguration
object. This poses a problem to make it linker-safe because the current reflection flow analysis doesn't support recursive properties. See dotnet/linker#1087. We will need this support to make this API linker-safe.The linker could decide to trim property setters and constructors which would cause the binder to not set properties correctly.
Here are the current warnings from the linker analysis on this assembly:
Regression?
No - this API has never been linker-safe.
Repro
Here's a simple application that doesn't work after being fully trimmed:
Running that application after trimming throws:
After forcing the linker to keep that constructor, I start getting:
The text was updated successfully, but these errors were encountered: