2

I have a Mono.Cecil.Cil.Instruction object representing a method call in code. I want to get the line number of the method call in the source file.

This old posting mentions using the SequencePoint property of the Instruction object: How to get source/line number for IL instruction using Mono.Cecil. However, I do not see this property in version 0.10.2 of Mono.Cecil.

Mark Nugent
  • 599
  • 2
  • 5
  • 20

1 Answers1

2

Found the solution here: http://cecil.pe/post/149243207656/mono-cecil-010-beta-1

Instruction.SequencePoint was removed. You must now use:

MethodDefinition method = ...;
Instruction instr = ...;
SequencePoint seqPoint = method.DebugInformation.GetSequencePoint(instr);
Mark Nugent
  • 599
  • 2
  • 5
  • 20