Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging in VS without the source code

I need to debug some assemblies due to they throw exceptions. It's my assemblies but I don't have the source code of them. What I have is their pdb files.

Is there any way to debug that assemblies by Visual Studio?

--EDIT--

Of course, I also can disassembly them to get *.il files of them. Would it help me somehow?

like image 485
Alan Coromano Avatar asked Nov 21 '12 16:11

Alan Coromano


People also ask

How debugging is done in VS code?

To bring up the Run and Debug view, select the Run and Debug icon in the Activity Bar on the side of VS Code. You can also use the keyboard shortcut Ctrl+Shift+D. The Run and Debug view displays all information related to running and debugging and has a top bar with debugging commands and configuration settings.


3 Answers

Actually there are a few ways to accomplish this:

  1. Use dnSpy - a free opensource .net debugger and assembly editor https://github.com/0xd4d/dnSpy
  2. Setup symbol server with dotPeek (also free) https://www.jetbrains.com/help/decompiler/Using_product_as_a_Symbol_Server.html
  3. Use Resharper decompiler to load symbols for external modules in your visual studio. I think this is the easiest way. I've described the whole process on my blog https://cezarypiatek.github.io/post/debug-without-sources-part-one/
like image 83
cezarypiatek Avatar answered Oct 12 '22 04:10

cezarypiatek


This is exactly why I paid for Reflector. Need to debug someone else's assembly? It works perfectly.

like image 42
hometoast Avatar answered Oct 12 '22 04:10

hometoast


As far as I know, the PDB files are just pointers for debugging. That is, if you don't have the source code then the PDB files will only give you the stacktrace.

I don't know if Visual Studio can handle it, you might need to hook up manually to the process.

like image 45
Nick.T Avatar answered Oct 12 '22 04:10

Nick.T