C#.NET VS2010 断点不起作用

发布于 2024-11-28 21:45:31 字数 306 浏览 2 评论 0原文

当我去调试代码时,所有断点都被透明填充(只留下轮廓),并且中间有一个感叹号的小三角形位于断点的角落。

当我将鼠标悬停在断点上时,错误是“当前不会命中断点”。源代码与原始版本不同。

我在一个多小时内没有尝试调试我的代码,在此期间我添加了一个具有多个线程函数的新类。

我已采取的步骤:

  1. 清理并重建项目
  2. 将选项“运行时,发生构建或部署错误时:”设置为“不启动”
  3. 重新保存项目。
  4. 将项目文件夹从闪存驱动器移至 HD
  5. 关闭并重新打开 VS2010

When I go to debug my code all my breakpoints are transparently filled (leaving only the outline) and a small triangle with an exclamation point in the middle is in the corner of the break-point.

The error when I hover over the break-point is 'The break-point will not currently be hit. The source code is different from the original version.'

I had not tried to debug my code in over an hour, and during that time I added a new class with multiple threading functions.

Steps I have taken:

  1. Clean and rebuild project
  2. Set option 'On Run, when build or deployment errors occur:' to 'Do not launch'
  3. Re-save project.
  4. Move project folder off of flash drive and onto HD
  5. Close and reopen VS2010

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

各自安好 2024-12-05 21:45:31

我知道您的类已执行,但未命中断点,并且当您构建并运行解决方案时,您会在构建文件夹中找到一个新创建的程序集。

要找出 VS 从哪里获取程序集,您可以首先在您尚未修改的某个类中设置一个断点,因此它肯定会被命中(例如在 Main 的末尾)。当断点被击中时,在 AppDomain.CurrentDomain.GetAssemblies() 中查找程序集,并在此处查找 Location 属性,该属性应该为您提供程序集加载的路径。

I understand that your class is executed, but the breakpoints are not hit, and that when you build and run your solution, you find a newly created assembly in your build folder.

To find out where VS is taking your assembly from you could first of all set a breakpoint in some class you have not modified, so it will certainly be hit (e.g at the end of your Main). When the breakpoint is hit look for your assembly in AppDomain.CurrentDomain.GetAssemblies(), and here look for the Location property which should give you the path your assembly has been loaded from.

盗梦空间 2024-12-05 21:45:31

我遇到了同样的问题,这是因为 VS2010 没有生成调试符号。我在尝试分析转储文件时无意中更改了设置。我能够通过以下方式修复它:

  1. 工具菜单中,选择选项
  2. 调试部分中选择符号 > 对话框
  3. 在底部的自动加载符号下,选择所有模块,除非排除
  4. 单击指定排除的模块链接,并确保该列表是空的。

I had the same problem and it was because VS2010 was not generating debug symbols. I had inadvertently changed a setting whiel trying to analyze a dump file. I was able to fix it this way:

  1. From the Tools menu, select Options
  2. In the Debugging Section select the Symbols dialogue
  3. At the bottom, under Automatically load symbols for select All modules, unless excluded
  4. click the Specify excluded modules link and make sure the list is empty.
花辞树 2024-12-05 21:45:31

转到工具--->选项--->调试--->一般---> 取消选中“要求源文件与原始版本完全匹配”--->单击“确定”。
这适用于 VS 2010

Go to Tools ---> Options --->Debugging ---> General ---> Uncheck "Require source file to exactly match the original version" ---> click ok.
This works for VS 2010

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文