May 15, 2007 at 10:13 AM
Edited May 15, 2007 at 10:17 AM
today I tried to extend the exception Handling Application Blog with an ExceptionHandler of my own. I use the local dlls and alreade switched the registry according to set the default on the correct directory. This is the implementation of the ExceptionHandler:
public class ExceptionLogHandler: IExceptionHandler
/// Logger (log4net) für Exception-Logging
private ILog log ;
/// Konstruktor mit Übergabe des Methodennamens der
/// Methode, in der die Exception aufgetreten ist
/// <param name="MethodenName">Name der aufrufenden Methode</param>
public ExceptionLogHandler ()
log = LogManager.GetLogger("ExceptionHandler");
#region IExceptionHandler Member
/// Loggen der Exception
/// <param name="exception">Exception</param>
/// <param name="handlingInstanceId"></param>
/// <returns>Die gleiche Exception, die reingekommen ist</returns>
public Exception HandleException (Exception exception, Guid handlingInstanceId)
string nachricht = "Exception-Message: " + exception.Message + "\r\n" +
This is a class in an Library-Project. This lib, the application and the EnterpriseLib are in separate directories and the above project links the local dlls of log4net and of the EnterpriseLib.
Trying to add this class as ExceptionHandler using the configurationTool leads to the known error:
"there were no types found in the assembly ... that implement or inherit from the base type ....IExceptionHandler"
As I found some posts over here, I tried and copied the ExceptionHandler.dll in the same directory as the EnterpriseLibs dlls. Didn't work. All dlls are linked to the applications Main project. If I add the ExceptionHandling-Tags manually to the app.config
the ConfigurationTool won't show the ExceptionHandling-Configuration next time I open the file.
<add name="Exception Policy">
<add type="System.Exception, mscorlib, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b77a5c561934e089"
<add type="Brenk.ExceptionLogHandler.ExceptionLogHandler, Brenk.ExceptionLogHandler, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null"
throwing an exception using the manually configured ExceptionHandler gives an Exception:
"No constructor for ExceptionLogHandler" what is wrong? I don't have any more ideas. Please help!
I found the solution by accident. Everything works fine since I installed the guidance Automation Tookit and Extensions. That's all. Perhaps it would be a good idea to add this to the documentation.....
You don't need the GAT/GAX to extend Enterprise Library.
If you want to use the Application Block Software Factory to help build providers or new application blocks, you will need GAT, GAX, and .NET 3.0.
The key for the first error you mentioned is that you probably needed the:
attribute on the class.
Off the top of my head, the second error occurred because you probably didn't have a constructor that took a
NameValueCollection to pass in customer attributes as specified by the CustomHandlerData in the configuration element.
I would have to see the class to be for sure on all these errors, but I know at one point I have received all of them when learning this stuff :)
But again, you don't need to have the GAT/GAX installed unless you are using the software factories / recipes put out by the P&P Team. The Application Block Software Factory happens to be one of them.
Microsoft MVP C#