【发布时间】:2016-03-16 03:46:44
【问题描述】:
在我的代码中,我使用典型的 try..catch 抛出并捕获了一个异常。异常中的消息是An error occured while executing the query. Please check the stack trace for more detail.
还有一个带有消息ValidationException was thrown. 的 InnerException。没有其他 InnerException。但是,当我通过 Visual Studio 2015 查看异常时,我可以展开异常,转到 InnerException 并展开它,我看到了:
InnerException: Nothing
InnerExceptions: Count=1
然后我可以展开 InnerExceptions 分支并查看我假设的 AggregateException,在本例中显示
(0): {"Error Parsing query"}
Raw View:
然后我可以展开 (0) 组以查看诸如“详细信息”之类的属性,该属性提供完整而详细的错误消息以及“错误代码”和许多其他属性。
当我尝试通过代码通过 ex.InnerException.InnerExceptions 引用“InnerExceptions”时,我不能,因为“InnerExceptions”不是“Exception”的成员。
它如何在 Visual Studio IDE 中可见但无法通过代码获得?
我正在编写使用 IppDotNetSdkForQuickBooksApiV3 NuGet 包的代码。我之所以提到这一点,是因为我不确定这是否是从 Intuit 的 API 中添加的。我以前从未遇到过 InnerExceptions 组。
要明确一点:遍历 InnerException 属性不会返回在上面提到的“详细信息”中发现的相同错误。
【问题讨论】:
标签: c# .net vb.net exception intuit