Open
Description
The implementation of this is to delete any stsfld
in the cctor and inject a ststfld
before the last ret in the method body but:
- There's no law the last
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). - There's no law that the only way to initialize a static is through a
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.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status