Following the documentation on the Debuggable Attribute that is set by the C# compiler and specifically the DebuggingFlags property, there is the flag IgnoreSymbolStoreSequencePoints which seems to be set regardless of Release/Debug configuration in Visual Studio and by csc-Roslyn 3.9 with every permutation of /debug /optimize options.
From what I can gather on the topic (here and here), there are two types of sequence points:
- explicit - in the SymbolStore, i.e. the pdb file
- implicit - IL instructions such as nop
So, the question is why does the C# compiler would not even have a command-line option to NOT set IgnoreSymbolStoreSequencePoints flag. As a comparison ilasm allows for use of sequence points from pdb:
/DEBUG Disable JIT optimization, create PDB file, use sequence points from PDB
/DEBUG=IMPL Disable JIT optimization, create PDB file, use implicit sequence points
/DEBUG=OPT Enable JIT optimization, create PDB file, use implicit sequence points
Doesn't this default C# Compiler behavior always prevent a better (although slower) debugging experience when the IgnoreSymbolStoreSequencePoints flag tells the JIT Compiler not to bother looking for sequence points in the pdb file. Or is Visual Studio's Debugger, Other Debugger's ignoring the attribute and still somehow loading explicit symbol points?