You may want to check the PDB file format and read the PDB file generated when compiling projects.
How to fin Class/Entity References and Line Number
Hi folks,
I hope you are doing well.
I want to write a program in C# that extract the class/entity references and with there line numbers where it is used in solution.
I do research from internet I have found some references() but it can't me help.
Could anyone one suggest me how i do it or there is any nugget package available for it.
Thank you.
3 answers
Sort by: Most helpful
-
-
Cheong00 3,476 Reputation points
2020-11-26T07:48:20.357+00:00 With the reference ISymbolReader in the blog page, you may want to see if you can get System.Diagnostics.SymbolStore.SymReader works for you. (Need to add reference to ISymWrapper.dll of your .NET runtime)
And there is source code for the PDB2XML tool. Check SymUtil class to see how to load ISymbolReader in C#.
-
Cheong00 3,476 Reputation points
2020-11-26T07:55:22.757+00:00 Btw, for .NET Core (i.e.: .NET 5+) there is another PDB format that is slightly different.