EntLib with Unity - "The type ConfigurationChangeEventSource cannot be constructed"

Topics: Enterprise Library Core
Aug 9, 2010 at 6:24 PM
Edited Aug 9, 2010 at 6:26 PM

I am trying to get the Exception Handling block working with injection via Unity, but am stumbling onto a weird error. The error is:

Resolution of the dependency failed, type = "MyProject.Utility.Exceptions.IExceptionHandler", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type ConfigurationChangeEventSource cannot be constructed. You must configure the container to supply this value.

It happens when I attempt to resolve my exception handler wrapper, IExceptionHandler (poorly named... not to be confused with the EntLib interface). I have IExceptionHandler mapped to a type in my Unity configuration, and I also add EnterpriseLibraryCoreExtension my container when it is created. And of course, I used the EntLib Configuration tool to create my Exception Handling and Logging settings.

I dug into the error a little bit, and the exception seems to happen pretty far down the chain when EntLib is creating an object of type LoggingUpdateCoordinator. It expects a ConfigurationChangeEventSource object to be passed to it. I can see that my container does have this type in it:

{Name = "ConfigurationChangeEventSource" FullName = "Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigurationChangeEventSource"}

I'm at a bit of a loss. As far as I can tell, everything should be hooked up right. Any suggestions?



Aug 10, 2010 at 6:11 AM
Edited Aug 10, 2010 at 6:28 AM

Hi Jason,

Could you kindly post your code and configuration on how you are encountering this error so that we can further investigate the problem. Thanks. For the meantime you can also refer to this thread and see if it may help http://entlib.codeplex.com/Thread/View.aspx?ThreadId=218740.

Gino Terrado
Global Technology and Solutions
Avanade, Inc.

Aug 12, 2010 at 4:22 AM


Thanks for the reply. I was putting together a small solution to reproduce this issue and had some difficulties getting it to happen. Meanwhile, I began to suspect the issue is caused by an EntLib assembly not being found. I tried again in my project with the issue, and it worked.

It did at one point seem like it was failing intermittently. But, it works now and I am mostly certain it had to do with assemblies not being found.