kombsh
kombsh

Reputation: 387

Break point not hit in Visual Studio Remote Debugging

Pls don't mark it as duplicate .. bcoz I have seen all the solutions but nothing is working for my case..

I have two machines devMachine and serverMachine

in devMachine I am developing application with Visual Studio and Now I have a simple Console Application..my need is I need to run this Console Application in serverMachine and debug from devMachine via Remote Debugging.

As told in Microsoft document, I have installed Remote Debugging tool in serverMachine and set the Authentication mode as Native (No Authentication) and run the Console Application in serverMachine.

Now , I have attached the remote process in devMachine's Visual Studio. All are working fine

But only problem is breakpoint is not hitting in Visual Studio

Note: I have placed required .pdb file in serverMachine and set that .pdb file path in devMachine's Visual Studio (Tools->Option->Debugging->Symbols).

enter image description here

Can anyone help me to resolve this issue?

Upvotes: 17

Views: 20361

Answers (5)

Tim Jarosz
Tim Jarosz

Reputation: 1178

I had an issue with Visual Studio not breaking at my breakpoints although it looked like everything was setup correctly for the remote debugger on an IIS machine. I searched everywhere for an answer. The issue finally presented itself when I tried to manually attach the VS debug to a process (VS menu --> Debug --> Attach to process...) For some reason, there were multiple processes for the same application pool (there should only be one process, not sure where the others came from) I logged into my IIS server and killed all the processes for my application pool and then restarted the IIS application. When I saw there was only one process for the app pool (as I expected), I tried debugging in Visual Studio and it attached to the correct process. It turns out that when there were multiple processes for the same application pool, it attached to the "wrong" one.

Upvotes: 1

AlfredoRevilla-MSFT
AlfredoRevilla-MSFT

Reputation: 3505

Don't attach and just set remote debugging on. Copy all the project files to the identically placed and named folder in the server during post-build.

enter image description here

enter image description here

Upvotes: 2

onlyme
onlyme

Reputation: 9

Looking at your screen shot, could it be simply because the break points are in the "main" function which could already have finished before you can attach the debugger?

Suggestion: Maybe put some artificial wait/delay code of say 20 secs in "main" above the first break point to give yourself enough time to attach to the process before "main" completes.

Upvotes: 0

AdmiralThrawn
AdmiralThrawn

Reputation: 392

There are two reasons for the remote debugger to not hit the breakpoint

  1. Wrong symbols.

  2. Using the wrong .Net framework while debugging ( you can select on the "attach to process" window in visual studio).

Upvotes: 2

Maria
Maria

Reputation: 858

What does the error message on the breakpoints say (if you hover over the breakpoint) - that it's different from the source? --> You can try disabling (from Tools/Options/Debugging) - Enable source file to exactly match the original version

What does the Modules window say - do the PDB's appear as loaded? if not, have you tried loading them manually (from the Modules window, right click the PDB and load)? - Is there an error message if it fails?

--> you might be in a case where the source files in the local machine are different from the ones on the remote one. Try copying everything over and see if that works (PDBs would be in the same folder as the EXE)

Upvotes: 11

Related Questions