views:

33

answers:

1

Given an assembly and its pdb, how do I get the line number and path to a method using .Net?

A: 

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 IDiaSymbol instance for the PDB in question, this is called the 'global scope'. Once you have that you will call findChildren() passing it the SymTagFunction enumeration which of type SymTagEnum. You will then need to enumerate over them and use an IDiaSession, previously made to get the global IDiaSymbol, instance to find the correct source and line number.

linuxuser27