using System;
public class C
{
static int M() => F() switch
{
1 => 1,
C { P: int p, Q: C { P: int q } } => G(() => p + q),
_ => 0
};
object P { get; set; }
object Q { get; set; }
static object F() => null;
static int G(Func<int> f) => 0;
}
Produces no debug info for method C.M (specifically, no sequence points).
Analysis:
ILBuilder.AllocateILMarker creates 2 ILMarkers, both at BlockOffset = 0: one user-code sequence point and another hidden one.
RealizeSequencePoints uses the last defined sequence point for the offset (the hidden one).
SequencePointList.GetSequencePoints then emits no sequence points since the only sequence point in the list is hidden.
The issue is with the hidden sequence point emitted for the switch expression closure.
See PDBTests.SwitchExpression_MethodBody.