Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The breakpoint will not currently be hit - Remote Debugging

I am having a problem with debugging a DLL (C#). The DLL is running on a server and I'd like to debug it with the Remote Debugger Tool from Visual Studio 2010.

I actually can attach to the process, but somehow I always get the following problem at my breakpoint: "The breakpoint will not currently be hit. No symbols have been loaded for this document."

Edit: The .pdb is on the server too.

like image 908
xileb0 Avatar asked Sep 30 '15 09:09

xileb0


People also ask

Why are my breakpoints not being hit?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

How do you add a breakpoint in Visual Studio 2022?

To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.


1 Answers

How are you getting the .pdb and .dll files on the remote server? They need to match exactly what is on your local machine. Look at the size of the files and make sure they match between the remote server and your local machine. If they are being built on different machines or with different build configs they will not match. You can copy/paste the bin folder from your local machine to the remote server to make sure the files match exactly. (Back up the server's bin first)

Are you attached to the right process? If you're not sure, try attaching to a few different processes. If your breakpoints work, one of those new processes is the correct one.

Try adding the remote server's bin folder as a symbol file location. This can be done in Options > Tools > Debugging > Symbols. This will tell Visual Studio to check that folder for symbol files.

I wrote this blog post about this after I faced the same issue, it may have a bit more information that will help.

like image 72
Brendan L Avatar answered Oct 13 '22 03:10

Brendan L