0

I am facing an issue with Experience Editor. Each placeholder is throwing null reference exception.

e.g. @Html.Sitecore().Placeholder("body-top")

I tried removing this placeholder but it will throw same exception on the next one. This keeps happening.

Error Rendering View: /Views/DemoSiteLayout/DemoSiteLayout.cshtml: Error while rendering view: '/Views/DemoSiteLayout/DemoSiteLayout.cshtml' (model: 'Sitecore.Mvc.Presentation.RenderingModel, Sitecore.Mvc'). at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) Inner Exception: Object reference not set to an instance of an object. at Sitecore.XA.Foundation.PlaceholderSettings.Services.LayoutsPageContext.GetLayout(String layout) at Sitecore.XA.Foundation.PlaceholderSettings.Services.LayoutsPageContext.GetSxaPlaceholderItems(String layout, String placeholderKey, Item currentItem, ID deviceId) at Sitecore.XA.Foundation.PlaceholderSettings.Pipelines.GetPlaceholderRenderings.GetAllowedRenderings.Process(GetPlaceholderRenderingsArgs args) at (Object , Object ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.XA.Foundation.Editing.Pipelines.GetChromeData.GetPlaceholderChromeData.Process(GetChromeDataArgs args) at (Object , Object ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.Pipelines.GetChromeData.GetChromeDataPipeline.Run(GetChromeDataArgs args) at Sitecore.Mvc.ExperienceEditor.Presentation.PlaceholderMarker.GetClientData() at Sitecore.Mvc.ExperienceEditor.Presentation.PlaceholderMarker.get_ClientData() at Sitecore.Mvc.ExperienceEditor.Presentation.PlaceholderMarker.GetStart() at Sitecore.Mvc.ExperienceEditor.Presentation.Wrapper..ctor(TextWriter writer, IMarker marker) at Sitecore.Mvc.ExperienceEditor.Pipelines.Response.RenderPlaceholder.AddWrapper.Process(RenderPlaceholderArgs args) at (Object , Object ) at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args) at Sitecore.Mvc.Helpers.SitecoreHelper.RenderPlaceholderCore(String placeholderName, TextWriter writer) at Sitecore.Mvc.Helpers.SitecoreHelper.Placeholder(String placeholderName) at ASP._Page_Views_SxaLayout_DemoSiteGridBody_cshtml.Execute() in c:\inetpub\wwwroot\DemoSite.local\Views\SxaLayout\DemoSiteGridBody.cshtml:line 7 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Sitecore.XA.Foundation.SitecoreExtensions.Services.RazorService.GetRazorViewAsString(Object model, String filePath) at Sitecore.XA.Foundation.Grid.Extensions.GridExtensions.GridBody(RazorExtensions helper) at ASP._Page_Views_DemoSiteLayout_DemoSiteLayout_cshtml.Execute() in c:\inetpub\wwwroot\DemoSite.local\Views\DemoSiteLayout\DemoSiteLayout.cshtml:line 52 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)

Page works fine in front end though.

Update: This error just helped me find out where the problem is (at placeholder) but doesn't seems to be very informative.

0
0

Whenever I see the "Error rendering view" message, I've found checking the Inner exception part of the error message helps a lot to find the root cause of the error.

So, as per the error info you've shared, in your case the Null Reference exception is happening at the following code i.e., Sitecore.XA.Foundation.PlaceholderSettings.Services.LayoutsPageContext.GetLayout(String layout). See below,

Inner Exception: Object reference not set to an instance of an object. at Sitecore.XA.Foundation.PlaceholderSettings.Services.LayoutsPageContext.GetLayout(String layout) at ..

A string type variable (named layout) is passed to this method LayoutsPageContext.GetLayout(String layout). So, this layout string variable should have been a NULL value while it was passed to the method.

You may have to check if anything is wrong with the layout

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.