如何跟踪可能抛出潜在异常的位置?

发布于 2024-09-06 16:51:08 字数 375 浏览 2 评论 0原文

我们在这里有很多关于堆栈跟踪和分析已引发的异常的问题。

我正在使用 RedGate Reflector 来检查一些 .net 类的工作原理。特别是,我正在查看 System.Data.SqlClient.SqlConnection 对象的 ConnectionString 属性。 Reflector 指示如果提供了无效的连接字符串,则此属性可能会抛出 ArgumentException

我的问题是:鉴于此属性可能会引发此特定异常,我如何分析代码以找到可能从何处引发异常?该属性调用另一个函数来设置该值。该函数不会直接抛出ArgumentException。我想知道如何找到可能抛出此异常的位置。

We have many questions here about stack traces and analyzing exceptions that have been thrown.

I am using RedGate Reflector to examine the workings of some .net classes. In particular, I am looking at the ConnectionString property of the System.Data.SqlClient.SqlConnection object. Reflector indicates that this property may throw an ArgumentException if an invalid connection string is supplied.

My question is: given that this property may throw this particular exception, how can I analyze the code to find where the exception might be thrown from? The property calls another function to set the value. This function does not throw the ArgumentException directly. I want to know how I can find where this exception might be thrown from.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

下壹個目標 2024-09-13 16:51:08

我还没有使用过它,但你可以看看 Jason Bock 的 ExceptionFinder for Reflector

I haven't used it but you might look at Jason Bock's ExceptionFinder for Reflector

很酷不放纵 2024-09-13 16:51:08

我以前从未使用过它,但我认为另一个 Red Gate 产品,Exception Hunter< /a> 就是为了做到这一点而设计的。

I have never used it before, but I think another Red Gate product, Exception Hunter, is designed to do this.

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