“The breakpoint will not currently be hit. The sou

2020-01-23 10:30发布

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'?

30条回答
来,给爷笑一个
2楼-- · 2020-01-23 10:48

If you have unchecked the DLL project in the Debug build configuration, your new code will never be built!

Go to Build --> Configuration Manager ... (in VS2010) and check if the project with the code you're trying to debug is checked for the current build configuration.

查看更多
闹够了就滚
3楼-- · 2020-01-23 10:48

I encountered this as well. The conditions that caused my issue:

  • I'm running a full IIS7 instance locally
  • I'm versioning my software into separate projects

I had caused this by opening a previous version (VS prompted to ask if I wanted to point to this instance in IIS debugging, I answered 'Yes'), then opening the current version (again responding to the IIS prompt with a 'Yes'), then attempting to debug in the previous version.

To solve, I merely closed and re-opened the previous and intended version, once again asserting it as the debugging source.

查看更多
闹够了就滚
4楼-- · 2020-01-23 10:49

For me it was while working on a WebSite project. After cleaning up these temp folders I got the proper compiler errors back:

  • C:\Documents and Settings\%username%\AppData\Local\Temp\Temporary ASP.NET Files
  • C:\windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

I finally resolved the problem when I discovered that a class file I had intentionally moved into a subfolder, somehow reappeared in the root folder. VS was using that one while I was editing the other.

查看更多
姐就是有狂的资本
5楼-- · 2020-01-23 10:53

Go to

  • Tools
    • Options
      • Debugging
        • General

Uncheck Require source files to exactly match the original version

查看更多
我欲成王,谁敢阻挡
6楼-- · 2020-01-23 10:55

This happens also when debugging a C++ project which loads a module that has been implemented with some CRL language (Managed C++, C# etc). In this situation the error message is misleading indeed.

The solution is to put Common language runtime (CLR) support configuration property to the startup project and recompile that.

查看更多
趁早两清
7楼-- · 2020-01-23 10:56

The problem is that your debug info is not in sync with your assembly. The solution is simple:

  1. Go to your bin folder
  2. Remove the .pdb files
  3. Rebuild

Should do the trick!

(the weird thing is, a rebuild without throwing away the .pdb files doesn't always work. I can see the modified date being updated, but still somewhere in the chain (VS2013 debugger, IIS, assembly cache) this change is not detected)

查看更多
登录 后发表回答