ActivationException: Activation error occured while trying to get instance of type ExceptionPolicyImpl, key "WCF Exception Shielding"

Topics: Exception Handling Application Block, Logging Application Block
Jun 23, 2010 at 3:38 PM

I'm using WCF Exception Shielding with Logging in EntLib5.  I'm periodically getting the following exception in my logs.

It looks like there's a missing [InjectionConstructor] attribute somewhere in the ExceptionPolicyImpl class. 

Is this a bug in Enterprise Library or is this something that I'm doing wrong? 

Thanks,
-Ben

-----------------------
Message: Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type ExceptionPolicyImpl, key "WCF Exception Shielding" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl", name = "WCF Exception Shielding".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type ExceptionPolicyImpl has multiple constructors of length 2. Unable to disambiguate.
-----------------------------------------------
At the time of the exception, the container was:

  Resolving Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl,WCF Exception Shielding
 ---> System.InvalidOperationException: The type ExceptionPolicyImpl has multiple constructors of length 2. Unable to disambiguate.
   at Microsoft.Practices.ObjectBuilder2.ConstructorSelectorPolicyBase`1.FindLongestConstructor(Type typeToConstruct)
   at Microsoft.Practices.ObjectBuilder2.ConstructorSelectorPolicyBase`1.SelectConstructor(IBuilderContext context, IPolicyList resolverPolicyDestination)
   at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey)
   at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
   at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService](String key)
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName)
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.ExceptionShieldingErrorHandler.ProvideFault(Exception error, MessageVersion version, Message& fault)

Jun 24, 2010 at 8:20 AM

Hi,

Could you send us your configuration used to repro this. Thanks.

 Gino Terrado
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com