NullReferenceException in EPiServer EPiResourcesController causing edit mode load to fail

In one of my current projects EPiServer‘s edit mode suddenly stopped working. Only the top bar loaded, while the rest failed due to a JavaScript error (see image below).

Internal server error while loading EPiServer's edit mode since DojoResource is failing.

NetworkError: 500 Internal Server Error caused by GetResourcesDictionary throwing NullReferenceException

To investigate, we tried surfing to the failing JavaScript resource (http://{host}/EPiServer/Shell/10.7.1.0/ClientResources/EPi/shell/ui/nls/en-us/contenttypes.js) only to discover that the 500 Internal Server Error was caused by a NullReferenceException.

NullReferenceException thrown by EPiServerResourcesController in the GetResourcesDictionary method.

Stack trace included at the bottom to allow for indexing.

Fixing our NullReferenceException in EPiResourcesController

It turned out that this particular NullReferenceException was caused by a malformed EPiServer language file having been pushed to the Git repositor; perhaps not all that straight forward to debug.

Cause being a malformed EPiServer language file.

Removing the faulty a and trying again fixed the problem.

Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   EPiServer.Shell.UI.Controllers.EPiResourcesController .GetResourceDictionary(String resourceKey, CultureInfo culture) +729
   EPiServer.Shell.UI.Controllers.EPiResourcesController .DojoResources(String pathInfo) +588
   lambda_method(Closure , ControllerBase , Object[] ) +138
   System.Web.Mvc.ReflectedActionDescriptor .Execute(ControllerContext controllerContext, IDictionary`2 parameters) +228
   System.Web.Mvc.ControllerActionInvoker .InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +34
   System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +79
   System.Web.Mvc.ControllerActionInvoker .InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +453
   System.Web.Mvc.ControllerActionInvoker .InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +453
   System.Web.Mvc.ControllerActionInvoker .InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +453
   System.Web.Mvc.ControllerActionInvoker .InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +453
   System.Web.Mvc.ControllerActionInvoker .InvokeAction(ControllerContext controllerContext, String actionName) +982
   System.Web.Mvc.Controller.ExecuteCore() +129
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +236
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler .ProcessController(IController controller) +50
   EPiServer.Shell.Web.Mvc.ModuleMvcHandler .BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +28
   System.Web.CallHandlerExecutionStep.System.Web .HttpApplication.IExecutionStep.Execute() +923
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1098.0 

Leave a Reply