Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

This Breakpoint Will Not Currently Be Hit, The Source Code is Different from the Original (even after cleaning/rebuilding)

.NET 4, console application. The project is set to 'Debug' mode. The breakpoint being set is in the primary/startup project. I have right-clicked -> Clean, and right-clicked -> rebuild, both on the Solution and project levels.

Following the instructions in this SO question, I have confirmed that my "Build and Run" options are set to 'prompt' for both 'When projects are out of date' and 'when build or deployment errors occur', and I am NOT getting a prompt when I F5 to build/run.

Also, the 'save all changes' under 'before building' is also selected (plus I manually saved them myself).

I monitored the output window of the application, see this line:

 'MyApplication.exe': (Managed (v4.0.30319)): Loaded 'C:\exepath' Symbols Loaded.

I restarted the VS2010 instance. I restarted all open VS2010 instances (of other projects). I've even gone through a reboot.

However, the breakpoint I am setting in the startup project is a hollow-red circle, with the notice that 'This breakpoint will not currently be hit, The source code is different from the original', and, in fact, is never hit.

So, this is really 2 questions:

1) How do I fix this problem so I can properly breakpoint

2) When I see this, does that mean my code is executing from an older build?

like image 977
CoolUserName Avatar asked Aug 09 '11 19:08

CoolUserName


People also ask

How do you fix the breakpoint will not currently be hit in VS 2022?

For this, simply open your "Solution Explorer", select your "Solution" and right click on it, Select "Clean Solution", once solution is cleaned, which will delete all the compiled and temporary files associated with a solution, select "Build" solution and then check if issue exists.

How do you enter a breakpoint in source code?

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.

Why is my breakpoint not working?

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.


1 Answers

I've had this problem once myself but that was on a vsto addin. In that case there were left over intermediate files under the users/appdata directories that were actually loaded instead of my app.

There is this blog article that has a whole load of possible reasons for this error and then a whole bunch more in the comments from other users

like image 146
Eddy Avatar answered Nov 16 '22 00:11

Eddy