Visual Studio 2015 中断未处理的异常不起作用 [英] Visual Studio 2015 break on unhandled exceptions not working

查看:35
本文介绍了Visual Studio 2015 中断未处理的异常不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 曾经有一个特定的复选框来中断未处理的异常".2015 年,它已被删除(或移到我找不到的地方).所以现在如果我没有提供用户级异常处理程序,我转换后的项目不再中断.我不想打破所有抛出的异常",因为我处理特定的异常.正是我未能提供特定处理程序的地方.

Visual studio used to have a specific checkbox to "Break on Un-handled exception". In 2015 this has been removed (or moved somewhere I cannot find it). So now my converted projects no longer break if I fail to provide a user-level exception handler. I don't want to break on all "thrown exceptions" because I handle specific ones. Just where I fail to provide a specific handler.

现在我的代码只是简单地退出当前过程并在下一个调用堆栈位置继续执行,不太好.

Right now my code simply exits the current procedure and continues execution at the next call stack location, NOT GOOD.

有人知道如何在 Visual Studio 2015 中恢复它吗?我昨天刚升级到社区版.

Anyone know how to get this back in Visual Studio 2015? I just upgraded to the community edition yesterday.

推荐答案

当您开始调试时,默认情况下右下方窗格中会出现一个名为异常设置"的新窗口.它具有您期望的所有选项.

There's a new window called "Exception Settings" that appears in the lower right pane by default when you begin debugging. It has all of the options you would expect.

你可以用 CTRL+ALT+E

这允许您挑选导致调试器中断的异常.

This allows you to cherry-pick which exceptions cause a break in the debugger.

不过,关键是您还可以设置这些异常是总是中断,还是仅在未处理的异常时中断——但设置这不是很直观.

The key, though, is that you can also set whether these exceptions always break, or only break when it's an unhandled exception -- but setting this is not very intuitive.

您需要先在工具">选项">调试"下选中仅启用我的代码".

You will need to first check "Enable Just My Code" under Tools > Options > Debugging.

这允许您在新的异常设置窗口中右键单击列标题(抛出时中断),并添加其他操作"列,然后您可以将每个异常设置为在用户未处理时继续代码".

This then allows you to right-click the column header (Break When Thrown) in the new Exceptions Settings window, and add the "Additional Actions" column, which then allows you to set each exception as "Continue when unhandled in user code".

因此,只需右键单击异常或整个组并禁用在用户代码中未处理时继续"标志.不幸的是,其他操作"列将显示为空,这与在用户代码中未处理时中断"相同.

So just right-click an exception or an entire group and disable the "Continue when unhandled in user code" flag. Unfortunately, the "Additional Actions" column will show up empty which is the same as "Break when unhandled in user code".

这里有更多相关信息:

http://blogs.msdn.com/b/visualstudioalm/archive/2015/02/23/the-new-exception-settings-window-in-visual-studio-2015.aspx

这篇关于Visual Studio 2015 中断未处理的异常不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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