An exception of type 'System.NullReferenceException' occurred in Orchard.OutputCache.dll but was not handled in user code

Topics: Core, General, Troubleshooting
Jun 5, 2014 at 11:23 PM
if Orchard is stable, i'm maybe doin'g something wrong?, please help.


this is the line

var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];

in this file

Orchard.Web\Modules\Orchard.OutputCache\Filters\OutputCacheFilter.cs

thank you in advance.
Jun 5, 2014 at 11:52 PM
i have changed
        var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];

with this
        var workContext = _workContextAccessor.GetContext(filterContext);
        var messagesZone = (workContext != null) ? workContext.Layout.Zones["Messages"] : null;

i don't still understand the Orchard logic because i'm new and i don't know if this is the right solution, but the workContext can be null

some help please.
Jun 13, 2014 at 8:41 AM
Hi,

I've got the same thing here when upgrading from 1.7.2 to 1.8 using the Inplace upgrade method or the new site method.
[NullReferenceException: De objectverwijzing is niet op een exemplaar van een object ingesteld.]
   Orchard.OutputCache.Filters.OutputCacheFilter.OnResultExecuted(ResultExecutedContext filterContext) +1294
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +442
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
Any idea why this is happening?