C#.NET VS2010 断点不起作用
当我去调试代码时,所有断点都被透明填充(只留下轮廓),并且中间有一个感叹号的小三角形位于断点的角落。
当我将鼠标悬停在断点上时,错误是“当前不会命中断点”。源代码与原始版本不同。
我在一个多小时内没有尝试调试我的代码,在此期间我添加了一个具有多个线程函数的新类。
我已采取的步骤:
- 清理并重建项目
- 将选项“运行时,发生构建或部署错误时:”设置为“不启动”
- 重新保存项目。
- 将项目文件夹从闪存驱动器移至 HD
- 关闭并重新打开 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:
- Clean and rebuild project
- Set option 'On Run, when build or deployment errors occur:' to 'Do not launch'
- Re-save project.
- Move project folder off of flash drive and onto HD
- Close and reopen VS2010
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我知道您的类已执行,但未命中断点,并且当您构建并运行解决方案时,您会在构建文件夹中找到一个新创建的程序集。
要找出 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.
我遇到了同样的问题,这是因为 VS2010 没有生成调试符号。我在尝试分析转储文件时无意中更改了设置。我能够通过以下方式修复它:
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:
转到工具--->选项--->调试--->一般---> 取消选中“要求源文件与原始版本完全匹配”--->单击“确定”。
这适用于 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