Built from source at 293d77f (0.1.17), net10.0, Windows x64. This is about the display class lifting added in 7175609.
A parameter captured by a lambda is listed twice in Locals, once from its own slot and once from the compiler generated environment's copy.
static void Outer(int captured)
{
var f = () => captured + 1;
Console.WriteLine(f()); // stop here
}
Locals shows captured twice, with the same value.
For a nested lambda the outer environment's names come back again on top of that, so the deeper the nesting the more repeats.
Expected is one entry per name. When a parameter has been hoisted into a display class, the environment's copy is the live one and the original slot is not updated, so the environment's copy is the one to show.
Built from source at
293d77f(0.1.17), net10.0, Windows x64. This is about the display class lifting added in 7175609.A parameter captured by a lambda is listed twice in Locals, once from its own slot and once from the compiler generated environment's copy.
Locals shows
capturedtwice, with the same value.For a nested lambda the outer environment's names come back again on top of that, so the deeper the nesting the more repeats.
Expected is one entry per name. When a parameter has been hoisted into a display class, the environment's copy is the live one and the original slot is not updated, so the environment's copy is the one to show.