Small example:
usingInlineIL;usingSystem;usingSystem.Runtime.CompilerServices;publicclassProgram{publicstaticvoidMain(){Foo(newC("A"));}[MethodImpl(MethodImplOptions.NoInlining)]privatestaticvoidFoo(Carg){IL.Emit.Ldarga(nameof(arg));IL.Emit.Ldarga(nameof(arg));IL.Emit.Call(newMethodRef(typeof(Program),nameof(Bar)));IL.Emit.Constrained<C>();IL.Emit.Callvirt(newMethodRef(typeof(C),nameof(arg.Baz)));}[MethodImpl(MethodImplOptions.NoInlining)]privatestaticintBar(refCo){o=newC("B");return0;}}publicrecordclassC(stringName){publicvoidBaz(intarg){Console.WriteLine(Name);}}Expected: B
Actual: A
Seen in #73606 (comment)
category:correctness
theme:importer
skill-level:intermediate
cost:small
impact:small
Small example:
Expected: B
Actual: A
Seen in #73606 (comment)
category:correctness
theme:importer
skill-level:intermediate
cost:small
impact:small