we've been getting this error lately and have no idea why, we are not modifying any collection, we even removed most foreach on the pages that we were getting the error. Here is the stacktrace of the error:
Exception type: InvalidOperationException
Exception message: Collection was modified; enumeration operation may not execute.
en System.Collections.Generic.List`1.Enumerator.MoveNextRare()
en System.Linq.Enumerable.WhereListIterator`1.MoveNext()
en System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
en System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
en System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
en System.Linq.Buffer`1..ctor(IEnumerable`1 source)
en System.Linq.OrderedEnumerable`1.<GetEnumerator>d__0.MoveNext()
en System.Linq.Buffer`1..ctor(IEnumerable`1 source)
en System.Linq.Enumerable.<ReverseIterator>d__a0`1.MoveNext()
en System.Web.Mvc.FilterProviderCollection.<RemoveDuplicates>d__b.MoveNext()
en System.Linq.Buffer`1..ctor(IEnumerable`1 source)
en System.Linq.Enumerable.<ReverseIterator>d__a0`1.MoveNext()
en System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
en System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
en System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
en System.Web.Mvc.FilterInfo..ctor(IEnumerable`1 filters)
en System.Web.Mvc.ControllerActionInvoker.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor)
en System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
en System.Web.Mvc.Controller.ExecuteCore()
en System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
en System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5()
en System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
en System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d()
en System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
en System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Any help is appreciated.