我正在尝试创建用于 EHAB 的自定义异常处理程序。我所能找到的只是 IExceptionHandler 接口,它只需要 HandleException 方法。但是,显然还有其他要求,因为我得到了这个例外:
System.InvalidOperationException
{"The type 'Paychex.IP.Common.TempClassLibrary.TempExceptionHandler, TempClassLibrary,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for custom exception handler
with name 'TempExceptionHandler' does not have the expected constructor
(C:\\Projects\\IP\\Common\\TempTestingConsole\\bin\\Debug\\TempTestingConsole.vshost.exe.Config
line 28)."}
如果有一个“预期的构造函数”,我如何找到关于它的文档?我应该从基类以及 IExceptionHandler 接口继承吗?(“临时...”课程只是我用来解决问题的沙箱,不会是最后的课程...)
更多信息:我的“沙盒”异常处理程序类如下:
[ConfigurationElementType(typeof(CustomHandlerData))]
public class TempExceptionHandler : IExceptionHandler
{
public Exception HandleException(Exception exception, Guid handlingInstanceId)
{
string oldMsg = exception.Message;
string newMsg = "Added by TempExceptionHandler: " + oldMsg;
ApplicationException newException = new ApplicationException(newMsg);
return newException;
}
}
我只是通过在 EntLib 配置实用程序中打开一个对话框来选择自定义处理程序类(在对话框的标题栏中)看到它才弄清楚对“[ConfigurationElementType(typeof(CustomHandlerData))]”属性的要求,但我不知道这意味着什么其他要求。