Search code examples
c#debuggingattach-to-process

How to attach to a process and debug the code that doesn't build?


I'm working on a project and trying to fix a bug found in the system. The code that I have access to doesn't build (it's a huge project with a lot of dll files, some of which are missing on my workspace). I have access to the part of the code I'm trying to debug, but can't build it. So I started the compiled .exe file and attached to it in VS. When I set a breakpoint in the code, it's disabled and says No symbols have been loaded for this document. So my question is, what additional info/files is the debugger looking for? I'm assuming it's looking for the pdb file for that specific assembly, which doesn't exist on my machine.

When I try to attach to the exe file, I get this warning:

enter image description here


Solution

  • what additional info/files is the debugger looking for? I'm assuming it's looking for the pdb file for that specific assembly, which doesn't exist on my machine.

    Your assumption is correct.

    Some ways you can solve your problem are:

    • Obtain the location of a symbol server that has your PDB, and configure VS to automatically download the PDBs.
    • Obtain the PDB via some other means.
    • Figure out how to build it yourself; build your own PDB.
    • Ask whomever did build it to debug the problem for you. It's probably their bug, so make them do the work.
    • Debug the problem by reading the sources and simulating the execution of the program in your head. When you come across code that doesn't do what it should in the simulation, that's your bug.
    • Debug the problem in the debugger, reading the assembly code instead of the sources.