检查某行是否由“try catch”处理

发布于 2024-12-22 17:45:58 字数 90 浏览 3 评论 0原文

有没有工具可以在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美男兮 2024-12-29 17:45:58

据我所知没有。有几个原因可以解释为什么这在 .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.

我不会写诗 2024-12-29 17:45:58

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文