Given an assembly and its pdb, how do I get the line number and path to a method using .Net?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You will need to use the DIA SDK. Microsoft does not have a managed interface for it, but using DIA in C# has been asked on StackOverflow before.
If you are going to try it out in native first you can get the information in question by getting the
IDiaSymbolinstance for the PDB in question, this is called the ‘global scope’. Once you have that you will callfindChildren()passing it theSymTagFunctionenumeration which of typeSymTagEnum. You will then need to enumerate over them and use anIDiaSession, previously made to get the globalIDiaSymbol, instance to find the correct source and line number.