2013-03-04 97 views
1

Exception类提供了如此多的属性,这些属性将提供更多含义引发异常的全部细节。获取抛出异常的类名称

InnerException-->Gets Exception instance that caused the current exception

Message-->Gets a message that describes the current exception.

Source--> Gets or sets the name of application or object that causes the error.

StackTrace -->Gets a string representation of immediate frames on the call stack.

Public property -->TargetSite Gets the method that throws the current exception.

但有时它没有任何意义。

at Microsoft.SharePoint.SPList.GetItemById(String strId, Int32 id, String strRootFolder, Boolean cacheRowsetAndId, String strViewFields, Boolean bDatesInUtc)  
   at Microsoft.SharePoint.SPList.GetItemById(Int32 id)  
   at JafraWFTest.JafraCustomWFActivity.<Execute>b__0()  

在这种情况下,我不知道任何东西,行号或类名称是造成异常。

so 如何找到导致异常的类名。

回答

0

请为您的问题添加一些许可。

  1. 你从哪里得到异常?它是您的自定义代码,还是 SP Designer?

  2. JafraWFTest.JafraCustomWFActivity您的代码或某些第三方?

  3. 你在哪里得到日志,14个Hive \ Logs?

所以如何找到这导致异常的类名。

抛出异常的类是JafraWFTest.JafraCustomWFActivity。这是一个自定义工作流程操作。执行时抛出异常。 <Execute>b__0()这意味着JafraWFTest.JafraCustomWFActivity采用Execute方法实现工作流操作的通用接口。

所以,如果JafraWFTest.JafraCustomWFActivity是你的代码看看JafraCustomWFActivity类在JafraWFTest命名空间和Execute方法。 如果它是第三方代码。尝试在应用程序BIN目录或GAC中查找JafraWFTest程序集(dll)。另一个应该与您的代码案例相同。

从代码语义上我假设它是自定义工作流操作的测试。检查JafraWFTest组件是否应该安装到GAC中,并且测试环境(站点,列表,列表项)已正确配置。