The type ExceptionPolicyImpl has multiple constructors of length 2. Unable to disambiguate.

Topics: Exception Handling Application Block, Policy Injection Application Block
Mar 3, 2011 at 11:08 AM

I have such an exception when using Policy Injection and Exception Handling Blocks when resolving an object which has [ExceptionCallHandler("Policy")] attribute.

Here is my config file:

      <add name="Policy">
          <add name="All Exceptions" type="System.Exception, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
              postHandlingAction="NotifyRethrow" />
      <add name="Policy1" order="0">
          <add type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.PolicyInjection.ExceptionCallHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
              exceptionPolicyName="Policy" name="Exception Handling Call Handler" order="0"/>

My class:

    public class A : MarshalByRefObject
        public void gg()
            throw new Exception("rrrr");
This also can be reproduced when running:
ExceptionPolicyImpl myPolicy = container.Resolve<ExceptionPolicyImpl>("Policy");

Basically i'm migrating from EntLib 4.1 to 5.1. In v4.1 everything worked just fine. I followed the instructions in Microsoft Migration Guidelines.

What should i do to be able using Policy Injection, Exception Hanling Blocks with ExceptionCallHandlerAttribute?

Thanks in advance.

Mar 4, 2011 at 12:46 AM

It should work.  Is this the configuration file of your executable project?  Is this configured on your default configuration file or on a separate? 

I just noticed though the order attribute in <add name="Policy1" order="0"> which I think shouldn't be there as it is not a valid attribute in that element.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Mar 21, 2011 at 12:44 PM

This line of code resolved this issue:

Thanks for your attention.

Mar 22, 2011 at 12:54 AM

Right, I should've noticed that before.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Jan 16, 2012 at 2:20 PM

any full sample code about it ?

where I put this line: container.AddNewExtension<EnterpriseLibraryCoreExtension>();

Jan 17, 2012 at 12:34 AM
Edited Jan 17, 2012 at 12:34 AM

You add the code when you want Unity to resolve Enterprise Library objects.  For example:


IUnityContainer container = new UnityContainer();
container.RegisterType<IService, Service>(
    new Interceptor(new InterfaceInterceptor()),
    new InterceptionBehavior<PolicyInjectionBehavior>());

If you are having specific problems, I would recommend creating a new post with the information for your scenario.

Randy Levy
Enterprise Library support engineer