This project is read-only.
1
Vote

Issue in Registering types using Microsoft.Unity 2.0

description

Hi,

We are using Unity2.0 with asp.net 4.5 framework.

We have used custom http module and registering types in every application start event.
Lifetimemanager is extended to use HttpContext.Current.Items

Below is the stack trace of the error:-

System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List1.Enumerator.MoveNextRare()
at System.Linq.Enumerable.WhereListIterator
1.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Microsoft.Practices.Unity.NamedTypesRegistry.RemoveMatchingKeys(Type t, String name)
at Microsoft.Practices.Unity.NamedTypesRegistry.RegisterType(Type t, String name)
at Microsoft.Practices.Unity.UnityDefaultBehaviorExtension.OnRegisterInstance(Object sender, RegisterInstanceEventArgs e)

at System.EventHandler
1.Invoke(Object sender, TEventArgs e)
at Microsoft.Practices.Unity.UnityContainer.RegisterInstance(Type t, String name, Object instance, LifetimeManager lifetime)

at Microsoft.Practices.Unity.UnityContainerExtensions.RegisterInstance[TInterface](IUnityContainer container, TInterface instance, LifetimeManager lifetimeManager)

at Stylelabs.Infrastructure.DI.UnityDIConfigurationBase.CreateServiceLocator()
at Medline.UI.Web.BootstrapperModule.<>c__DisplayClass2.<OnStart>b__1()
at Stylelabs.Infrastructure.AdamSpecific.Security.AdamFormsAuthenticationModule.context_AuthenticateRequest(Object sender, EventArgs e)

at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


This issue is happening intermittently on production server. Any pointers in this would be greatly appreciated.

comments