Visual Studio 2015 调试器因 DebuggerHidden 函数的处理异常而停止 [英] Visual Studio 2015 debugger stops for a handled exception of a DebuggerHidden function

查看:26
本文介绍了Visual Studio 2015 调试器因 DebuggerHidden 函数的处理异常而停止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望调试器在以下情况下停止:

  • 发生已处理或未处理的异常.
  • 在具有 DebuggerStepThrough 或 DebuggerHidden 属性的函数中发生未处理的异常.调试器应在调用此函数的位置停止.

到目前为止没有问题,我可以让 Visual Studio 2015 像这样工作.但是,当具有 DebuggerStepThroughDebuggerHidden 属性的函数内发生已处理异常时,调试器会在调用此函数的位置停止.>

我找不到解决此问题的方法.我不记得 Visual Studio 2010 或 2013 上的这种行为.我搜索过它,但没有发现有人问过同样的问题.

我试过 DebuggerNonUserCode,结果是一样的.它说抛出异常".不,不是的!

我的设置:

解决方案

您可以在 VS2015 中使用 DebuggerNonUserCode 属性而不是 DebuggerStepThrough 或 DebuggerHidden 属性,因为它们之间存在一些小的差异:

I want the debugger to stop when:

  • A handled or unhandled exception occurs.
  • An unhandled exception occur in a function that has a DebuggerStepThrough or DebuggerHidden attibute. Debugger should stop where this function is being called.

There is no problem so far, I could able to make Visual Studio 2015 work like that. However when an handled exception occurs inside a function that has a DebuggerStepThrough or DebuggerHidden attibute, the debugger stops where this function is being called.

I couldn't find a way to fix this. I don't remember this behavior on Visual Studio 2010 or 2013. I've searched about it, and did not find anybody asking about the same issue.

Edit: I have tried DebuggerNonUserCode, result is the same. It says "Exception thrown". No it does not!

My settings:

解决方案

You could use the DebuggerNonUserCode Attribute instead of the DebuggerStepThrough or DebuggerHidden attribute in VS2015 since there are a few small differences between them:

https://blogs.msdn.microsoft.com/visualstudioalm/2016/02/12/using-the-debuggernonusercode-attribute-in-visual-studio-2015/

Update:

I get the same issue as yours using the VS2015. I found that it would be related to on debugging option, please enable the option "Use Managed Compatibility Mode" under TOOLS->Options->Debugging. Debug it again.

这篇关于Visual Studio 2015 调试器因 DebuggerHidden 函数的处理异常而停止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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