Enterprise Library Configuration application cannot find Custom Exception Handler that inherits IExceptionHandler in assembly

Posted on 2007-10-02
Last Modified: 2013-12-17
I have an application written in C# that builds as a Windows Application.  I am trying to use the Enterprise Library Exception Handling Block provided by Microsoft:

And I have been implementing it by following the instructions on this page:

In a nutshell, I have added an extra class to my application all with the same namespace and within the same executable, and the class is as thus (stripped down for brevity):

    using System;
    using System.Collections.Specialized;
    using System.Windows.Forms;
    using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
    using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
    using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
    using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration;

    namespace MyNamespace
        public class AppMessageExceptionHandler : IExceptionHandler
            public AppMessageExceptionHandler(NameValueCollection ignore)

            public Exception HandleException(Exception exception, Guid correlationID)
                return exception;

Then, I modify my App.config file using Enterprise Library Configuration. I have added the Exception Handling Application Block to the file in the way described here:

Then added to that an Exception Policy, then added to that an Exception Type, then added to that a Custom Handler. This is where I get the problem. In the attributes for the Custom Handler, I try to modify the 'Type'. I press the elipsis which pops up a 'Type Selector' dialogue. I press the 'Load an Assembly' button and then select my executable containing my type (AppMessageExceptionHandler as above). An message box then pops up saying:

    "There were no types found in the assembly 'My Application' that implement or inherit from the base type 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.IExceptionHandler'."

But my assembly clearly does contain a type inheriting IExceptionHandler. Am I missing something? Any help would be greatly appreciated. Thanks!
Question by:Xtreem
    LVL 17

    Expert Comment

    try fully enumerating the inheritance of the IException handler

    public class AppMessageExceptionHandler : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.IExceptionHandler

    Author Comment

    This wouldn't make any difference as it's the resultant executable that is being read by Enterprise Library Configuration and the same byte code is built regardless of whether IExceptionHandler is fully-qualified or not.

    I tried it anyway and, as expected, no difference.

    Accepted Solution

    The problem is discussed quite in-depth here:

    And the reason for the problem is talked about here:

    However, I was actually referencing the Microsoft signed (precompiled binaries) version of EntLib in my project and the correct Enterprise Library Configuration ("Program Files\Microsoft Enterprise Library 3.1 - May 2007\Bin\EntLibConfig.exe").  But this wasn't working.  So I just changed to use the unsigned version of EntLib ("EntLib3Src\bin") and it all seems to work now.  No real difference to using either.  As Tom Hollander says in the second link above, neither option is inherently right or wrong.
    LVL 1

    Expert Comment

    Closed, 500 points refunded.
    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now