Search code examples
.netdebug-symbolsilmono.cecil

What does Instruction.Offset represent in mono.cecil?


Can I interpret this as the line number in the source file?


Solution

  • No, Offset is the position of the instruction inside the method IL. It's used to implement branches.

    To get line numbers you must use either Mono.Cecil.[Pdb|Mdb].dll (MS or Mono debugging symbols) and the SequencePoint. If that's what you're after then look at Gendarme source code for symbols.