Visual Studio 2010调试器不再停止错误 [英] Visual Studio 2010 debugger is no longer stopping at errors

查看:134
本文介绍了Visual Studio 2010调试器不再停止错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天正在使用Windows应用程序,当我们的错误不再像他们通常那样显示时。相反,调试器只是跳出方法。输出窗口记录了异常,但是没有出现通常的弹出跟踪。

I was working on a Windows app today, when my errors were no longer being displayed as they usually would. Instead, the debugger just jumps out of the method. The output window makes a note of the exception, but the usual popup trace does not appear.

它适用于其他项目,我把 Dim i as Integer =A作为我的第一行尝试提出一个错误,但它只是退出该行上的sub。

It works in other projects, and I have put Dim i as Integer = "A" as my first line to try and raise an error, but it just exits the sub on that line.

任何想法如何收回?

推荐答案

调试器和64位版本的Windows 7之间的交互在Load事件中发生的错误。一个例外被Windows捕获和吞噬,调试器从来没有机会检测到它是未处理的。您唯一可以看到的是输出窗口中的第一次机会通知。 Load事件处理程序将立即终止,并且您的程序继续运行,就好像没有发生任何事情,假设它没有绕过一个关键的初始化代码。这个bug已经存在了很长时间,而且是微软所熟知的,显然很难解决。

There is a bug in the interaction between the debugger and the 64-bit version of Windows 7 that strikes in the Load event. An exception is trapped and swallowed by Windows, the debugger never gets a chance to detect that it was unhandled. The only thing you'll see is a "first chance" notification in the Output window. The Load event handler will immediately terminate and your program keeps running as though nothing happened, assuming that it didn't bypass a critical piece of initialization code. This bug has been around for a long time and is well known to Microsoft, apparently it is difficult to fix.

你可以使用Project + Properties编译来解决这个bug选项卡,向下滚动,高级编译选项按钮。将目标CPU设置更改为AnyCPU。陷阱的另一个方法是调试+异常,勾选CLR异常的抛出复选框。另一种解决方法是将初始化代码放在构造函数中而不是OnLoad()或Load事件中。当您需要了解窗口的实际大小时,您只需要加载。

You can work around this bug with Project + Properties, Compile tab, scroll down, Advanced Compile Options button. Change the Target CPU setting to "AnyCPU". Another way to trap it is with Debug + Exceptions, tick the Thrown checkbox on CLR Exceptions. Yet another workaround is to put initialization code in the constructor instead of OnLoad() or the Load event. You only really need Load when you need to know the actual size of the window.

此错误只会在调试时发生。在用户的机器上不会发生这种情况。

This bug will only strike when you debug. It won't happen on your user's machine.

更新:我在这篇文章

这篇关于Visual Studio 2010调试器不再停止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆