Consider dropping support for <field initialize="true" />
#107379
Labels
area-Tools-ILLink
.NET linker development as well as trimming analyzers
in-pr
There is an active PR which will close this issue when it is merged
Milestone
https://github.com/dotnet/linker/blob/main/docs/data-formats.md#override-static-field-value-with-a-constant
The implementation of this is to delete any
stsfld
in the cctor and inject aststfld
before the last ret in the method body but:ret
of the method body needs to be executed at all (there could be an if/else in the cctor that just terminates early, never executing the injected code, or an EH block, or anything else).stsfld
in the cctor. It could be initialized from a method the cctor calls, it could be initialized throughldsflda
/stind
, etc.I don't know what use case motivated
initialize
, but given the real complexity of implementing it properly is much higher than the simple thing IL Linker has, it should be put under scrutiny whether we need it in the first place. If we need it, the above are bugs.The text was updated successfully, but these errors were encountered: