Strange exception in MVC

Very rarely, the following exception is in my MVC 3 application. This is only in Release mode, and only a restart of the IIS application pool starts at startup. Can anyone give me a hint what might cause this error?

And an exception:

System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.Mvc.FilterProviderCollection.<RemoveDuplicates>d__b.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.<ReverseIterator>d__a0`1.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at System.Web.Mvc.FilterInfo..ctor(IEnumerable`1 filters) at System.Web.Mvc.ControllerActionInvoker.GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at System.Web.Mvc.MvcHandler.<>c__DisplayClass6.<>c__DisplayClassb.<BeginProcessRequest>b__5() at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0() at System.Web.Mvc.MvcHandler.<>c__DisplayClasse.<EndProcessRequest>b__d() at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 
+4
source share
1 answer

It looks like you are modifying the GlobalFilters collection without blocking. This can happen when accessing this collection, for example, from the IHttpModule.Init file, which is called for each HttpApplication created by the runtime. If this problem was once.

Use WebActivator or simply Global_asax App_Start to create such global collections.

+1
source

Source: https://habr.com/ru/post/1502424/


All Articles