Last Friday morning we had a very unusual ocurance. We deployed a small change to our website, after which we performed an application pool recycle for it to pick up these changes. Immediately our ASP.Net 4.0 site had issues with one particular
section (the rest of the site was performing perfectly). We were getting thousands of these exceptions in the logs.
Exception is: IndexOutOfRangeException - Index was outside the bounds of the array.
At the time of the exception, the
Resolving Fred.Services.Person.ViewListing,ServiceHost (mapped from Fred.Services.Person.IViewListing, ServiceHost)
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.List`1.Add(T item)
context, IPolicyList resolverPolicyDestination, ConstructorInfo ctor) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPl...)." time="2012-02-16T21:14:59.0249474Z">
To resolve the issue all we did was recycle the application pool again (however it took us a about 30 minutes to realise this was happening).
What is strange is we have a farm of 9 web servers all which were recycled around the same time. We also recycle app pools nearly twice a day (for deployments and other changes) and we have never seen this problem before in the 18 months of using Unity.
We are using Microsoft.Practices.Unity version 2.0.414.0.
I've also noticed someone else having a very similar problem but with no resolution.
Is there a bug in Unity that occurs randomly when handling application pool recycles or is there something else we need to know of?