-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
From #50270 (comment)
Given nested switch expressions, with lambdas like this:
return o switch
{
int i => new Func<string>(() => i.ToString() + i switch
{
1 => new Func<string>(() => string.Concat(""One"", i))(),
_ => ""Don't know""
})(),
_ => ""Don't know""
};This emits one closure in the PDB info, starting at the offset for the inner switch keyword.
<encLambdaMap>
<methodOrdinal>0</methodOrdinal>
<closure offset=""174"" />
<lambda offset=""157"" closure=""0"" />
<lambda offset=""241"" closure=""0"" />
</encLambdaMap>The offsets above are from the test case linked above, which is slightly different, but you can see that the first lambda starts before the closure it is part of, which seems odd to say the least.
Reactions are currently unavailable