NullReferenceException

NullReferenceException

本文介绍了尽管在调试选项中设置了复选框,Visual Studio Debugger不会在NullReferenceException上中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手动将Visual Studio 2012网站"迁移到"ASP Web项目",以便能够使用特定于环境的web.config(使用转换).

I manually migrated a Visual Studio 2012 "website" to a "ASP web project" to be able to use environment-specific web.configs (using transformation).

迁移后,调试器不会再因异常而停止.

After migration my debugger does not stop anymore at exceptions.

在输出视图中,我看到引发了NullReferenceException,我的HTTP-REST-client收到"400错误请求",但调试器忽略了该异常.

In my output view I can see that a NullReferenceException is raised, my HTTP-REST-client receives "400 bad request", but the debugger ignores that exception.

我按照说明启用了例外(如何允许在VS2010中打破"System.NullReferenceException"?).在对话框"debugging" =>"Exceptions ..."中,启用了NullReferenceExceptions,并且重置所有复选框也无济于事.

I followed the instructions to enable exceptions ( How do I allow breaking on 'System.NullReferenceException' in VS2010? ). In the dialog "debugging"=>"Exceptions..." NullReferenceExceptions are enabled and resetting all checkboxes does also not help.

断点按预期工作.

编译器还有一些奇怪的行为:即使代码包含语法问题,编译也会成功.(但这可能是一个单独的问题)

The compiler also has some strange behaviour: compilation will succeed even if the code contains syntax problems. (But this might be a separate issue)

如何重新启用调试器?

推荐答案

在我启用选项" =>调试" =>中的仅我的代码"后,该问题似乎已解决.一般的".(另请参见 Visual Studio 2013"处理异常",即不起作用,也不会破坏).

The issue seems to be fixed after I enabled "Just My Code" in "Options"=>"Debugging"=>"General". (see also Visual Studio 2013 "break on handled exceptions" not working, not breaking ).

这篇关于尽管在调试选项中设置了复选框,Visual Studio Debugger不会在NullReferenceException上中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 04:31