167098573cbcd1de9c1e61ca747a8ca505329967
CachedDelegateInitializationWithField only fired when the instruction after the caching `if` read the cache field exactly once. A discarded conversion -- `_ = (Action<int>)M;` -- reads it zero times: Roslyn emits the null check and the store, and nothing else. The transform bailed out, so the `<>O` cache class and its `<0>__M` field survived into the output under names no C# compiler will accept. Zero usages is now handled: the `if` is replaced by the delegate construction it guarded, which is what the source expressed, and the caching disappears with the field. The rest of the method is checked for loads of the same field first, since only then is this `if` the sole initialization. Closes #3965
Description
My contributions to icsharpcode/ILSpy: 16 commits, 3 merged PRs
202 KiB
0 Stars
1 Watchers
0 Forks
Languages
C#
99.9%