2

Closed

NullReferenceException Object reference not set to an instance of an object

description

Hello.

There is an issue in DonutOutputCacheAttribute stuff.
In My controller there are actions, all of them are marked by [DonutOutputCache(CacheProfile = "DynamicContent")] attribute. Also I have overridden OnActionExecuting method. In that method I have following code:
if (Request.Path.Contains("/region/"))
                filterContext.Result = RedirectPermanent(Request.Path.Replace("/region", ""));
After that DonutOutputCacheAttribute will never call their own OnActionExecuting method and _cacheSettings will be null.

StackTrace:
Stack trace: at DevTrends.MvcDonutCaching.KeyGenerator.GenerateKey(ControllerContext context, CacheSettings cacheSettings)
at DevTrends.MvcDonutCaching.DonutOutputCacheAttribute.OnResultExecuted(ResultExecutedContext filterContext)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c_DisplayClass25.<BeginInvokeAction>b22(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<>cDisplayClass1d.<BeginExecuteCore>b18(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>cDisplayClass4.<MakeVoidDelegate>b3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>cDisplayClass4.<MakeVoidDelegate>b3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.<>cDisplayClass8.<BeginProcessRequest>b3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>cDisplayClass4.<MakeVoidDelegate>b_3(IAsyncResult ar)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

comments