'UnityContainer.Registrations' throws exception while enumerating.

Mar 15, 2010 at 1:12 PM

An excerpt from the property getter:

return (from type in allRegisteredNames.Keys
  from name in allRegisteredNames[type]
  select new ContainerRegistration(type, name, this.policies));

new ContainerRegistration(...) tries to set the LifetimeManager instance in the constructor, which fails for some registrations: for some reason ContainerRegistration.GetLifetimeManager() resolves an ObjectBuilder ITransientLifetimeManager instance, and this cannot be casted to LifetimeManager. How can I avoid, that an entry gets registered with an ITransientLifetimeManager?

Mar 15, 2010 at 4:41 PM

I think this one's the same with this issue, please refer to this thread - http://unity.codeplex.com/Thread/View.aspx?ThreadId=83915.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.