public KeyValuePair<string, int> GetFileLine(Instruction ins, MethodDefinition method, bool bSearchForward)
{
using (Tracer t = new Tracer(myType, "GetFileLine"))
{
t.Info("Try to get file and line info for {0} {1} forwardSearch {2}", method.DeclaringType.FullName, method.Name, bSearchForward);
var symReader = this.LoadPdbForModule(method.DeclaringType.Module);
if (symReader != null && method.Body != null)
{
Instruction current = ins;
if (bSearchForward)
{
current = this.GetILInstructionWithLineNumber(ins, true);
if (current == null)
{
current = this.GetILInstructionWithLineNumber(ins, false);
}
}
else
{
current = this.GetILInstructionWithLineNumber(ins, false);
if (current == null)
{
current = this.GetILInstructionWithLineNumber(ins, true);
}
}
if (current != null)
{
return new KeyValuePair<string, int>(this.PatchDriveLetter(current.SequencePoint.Document.Url), current.SequencePoint.StartLine);
}
}
else
{
t.Info("No symbol reader present or method has no body");
}
return new KeyValuePair<string, int>("", 0);
}
}