C# 调试时断点未命中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1899428/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 21:43:51  来源:igfitidea点击:

break point is not hitting while debugging

c#asp.net

提问by subash

Possible exact duplicates:

Reason for VS.NET ‘current breakpoint will not be hit' warning?
Why does Visual Studio sometimes not go to my breakpoints?
Why would the debugger not be stopping at a breakpoint in my ASP.NET application?

可能的完全重复:

VS.NET“当前断点不会被命中”警告的原因?
为什么 Visual Studio 有时不转到我的断点?
为什么调试器不会在我的 ASP.NET 应用程序的断点处停止?

while debugging,the modified source code the break point is not hitted for a particular aspx page and the following error is shown in the break point

调试时,修改后的源代码没有针对特定的aspx页面打断点,断点显示以下错误

"the break point will not be currently hit.the source code is different from the original version"

“当前不会命中断点。源代码与原始版本不同”

but for other page it is working fine.

但对于其他页面,它工作正常。

采纳答案by RameshVel

Some times this occurs if the sourcecode is been copied from the network folder, it messes up the symbol settings. Below solution works for me everytime

如果源代码是从网络文件夹复制的,有时会发生这种情况,它会弄乱符号设置。以下解决方案每次都对我有用

  • In debug mode, select debug->windows->modules
  • Check your dll symbolStatus . Make sure that it is loaded into the project (i am sure now the status is not loaded )
  • Right click your dll, click symbol settings.
  • And manually add your symbol path (.pdb file path)
  • And again right click the dll, and click load symbols
  • 在调试模式下,选择 debug->windows->modules
  • 检查您的 dll 符号状态。确保它已加载到项目中(我确定现在状态未加载)
  • 右键单击您的 dll,单击符号设置。
  • 并手动添加您的符号路径(.pdb 文件路径)
  • 再次右键单击dll,然后单击加载符号

Hope this helps

希望这可以帮助

回答by Jon Skeet

That suggests the build that's running doesn't match with your code.

这表明正在运行的构建与您的代码不匹配。

Try performing a "clean", make sure that you've stopped any previous debugger sessions etc, then rebuild and retry.

尝试执行“清理”,确保您已停止任何以前的调试器会话等,然后重建并重试。

回答by Zia Ur Rahman

It worked for me. Try this.

它对我有用。尝试这个。

First try rebuilding your project by right mouse click the project > Rebuild If that doesn't work, try a clean of the project (right mouse click on the project > clean)

首先尝试通过鼠标右键单击项目> 重建来重建您的项目 如果这不起作用,请尝试清理项目(鼠标右键单击项目> 清理)

If that didn't work check this:

如果这不起作用,请检查:

Right mouse click your project
select [Properties]
select the [Build] tab
make sure [Define DEBUG constant] and [Define TRACE constant] are checked
Click the [Advanced] button at the bottom of the Build tabpage
Make sure that [Debug Info:] is set to [full]
Click [OK] and rebuild the project ;-)

Hope that works for you! (step 6 generates the .pdb files, these are the debugging symbols)

希望对你有用!(第 6 步生成 .pdb 文件,这些是调试符号)

回答by Barkster

make sure there are not instances of w3wp.exe running. I had several and closing them fixed it for me.

确保没有运行 w3wp.exe 的实例。我有几个,关闭它们为我修好了。

回答by pKay

In my i changed the connection string but in the browser it was referring to old string so i just did 'empty cache and hard reload in chrome browser' and it worked

在我的我更改了连接字符串,但在浏览器中它指的是旧字符串,所以我只是在 chrome 浏览器中执行了“清空缓存和硬重新加载”并且它起作用了

回答by zokaee hamid

This problem occurred to me when I had copied the project. In fact, by opening the old code file if breakPoint is inserted, you will see that it will work. So learn the correct copying method.

当我复制项目时,我遇到了这个问题。事实上,如果插入了breakPoint,通过打开旧的代码文件,你会看到它会起作用。所以要学会正确的抄写方法。