检查某行是否由“try catch”处理
有没有工具可以在 Visual Studio 中检查一行是否由“try catch”块处理? 当然不仅仅体现在路线的方法上。所有调用方法。
问候克里斯
is there a tool or so to check in Visual Studio if a line is handled by a "try catch" block?
Of course not only in the method of the line. All calling Methods to.
regards Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知没有。有几个原因可以解释为什么这在 .NET 中是不可能的/不平凡的。首先,如果不“反编译”方法的字节码,就不可能确保一行抛出异常。与 Java 不同,.NET 不提供指定抛出哪些异常的语言规范。有文档规范,但没有强制要求文档已填写或正确。在 Java 中,您必须声明方法可以抛出哪些异常,这使得这在 Java 中成为可能。
As far as I know there is not. There's a couple reasons why this would be impossible/non-trivial in .NET. The first of which is that it is impossible to ensure a line throws an exception without "decompiling" the bytecode of the method. Unlike in Java, .NET does not provide for a language specification which specifies what exceptions are thrown. There is a documentation spec, but there's no enforcements that the documentation is filled out or correct. In java you have to declare what exceptions a method can throw which is what makes this possible in Java.
ReSharper 曾经有一个名为 Exceptional 的插件,试图做类似的事情。它在 R#5.1 处停止,但您也许可以重新激活它。
ReSharper used to have a plugin called Exceptional that tried to do something similar. It stopped at R#5.1, but you might be able to reanimate it.