Endjin.Assembly.ChangeDetection.Introspection.PdbInformationReader.GetFileLine C# (CSharp) Method

GetFileLine() public method

Get for a specific IL instruction the matching file and line.
public GetFileLine ( Instruction ins, Mono.Cecil.MethodDefinition method, bool bSearchForward ) : int>.KeyValuePair
ins Mono.Cecil.Cil.Instruction
method Mono.Cecil.MethodDefinition
bSearchForward bool Search the next il instruction first if set to true for the line number from the pdb. If nothing is found we search backward.
return int>.KeyValuePair
        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);
            }
        }

Same methods

PdbInformationReader::GetFileLine ( MethodBody body ) : int>.KeyValuePair
PdbInformationReader::GetFileLine ( Mono.Cecil.MethodDefinition method ) : int>.KeyValuePair
PdbInformationReader::GetFileLine ( Mono.Cecil.TypeDefinition type ) : int>.KeyValuePair