When debugging in Visual Studio, sometimes I add a breakpoint but it's hollow and VS says "The breakpoint will not currently be hit. The source code is different from the original version." Obviously this prevents me from being able to debug.
What on earth does the message mean? What original version? If I've just opened up the solution and not made any changes whatsoever to the code, how can there be an 'original version'?
This can happen when the system time changes while debugging or between debug sessions, be it programmatically, manually or by an external program.
First I tried from command line;
deleting temp files from command line did work.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files>rd /s root
When I disable "Enable Just My Code" option in Tools -> Options -> Debugging -> General
The problem resolved for me. It is a WCF application, was trying to debug an ashx page. http://blogs.msdn.com/b/zainnab/archive/2010/10/25/understanding-just-my-code.aspx
Under Windows 7, Visual Studio Express 2010, if you have activated the option Use compatibility mode for Windows XP SP3, this error may occur.
I unchecked the option and it worked perfect again. Right-click on the shortcut to VS or the executable, select properties and then compatibility.
Closing Visual Studio and reopening the solution can fix the problem, i.e. it's a bug within the IDE itself (I'm running VS2010).
If you have more than one instances of Visual Studio running, you only need to close the instance running the solution with the problem.
You can get this message when you are using an activator and the assembly you set the breakpoint into has not been loaded yet.
The breakpoint will resolve once the activator loads the assembly (assuming the assembly and debug symbols are up to date). A good place to look at is the modules window in the debugging menu. There you should look for the assembly which your file belongs too. First check that the assembly is loaded. Then, from where is it loaded? Then, is the symbols file loaded. Again, where is the symbols file loaded from? Finally check the versions of both.
If you have more than one projects in your solution, then make sure that the correct project is set as the
StartUp Project
. To set a particular project as the Startup Project of your solution, Right-click the project, chooseSet As StartUp Project
.After I set my StartUp Project correctly, desired break-point was reached by the thread.