sitecoresitecore9

Sitecore 9.0 - Error when editing personalization rule - element is null


When I try to edit a personalisation rule on a component, I'm getting the following error:

enter image description here

In my browser's network tab, I can see that a request is being made to the following URL:

/sitecore/shell/-/xaml/Sitecore.Shell.Applications.Rules.RulesEditor.aspx?hdl=584EB7FC4C5D4AD6A9A21EED4F48D2AA

The response is a YSOD, which contains the following stack trace:

[InvalidOperationException: element is null]
   Sitecore.Shell.Applications.Rules.RulesEditor.RulesEditorPage.Edit(String uid, String name, String control, String parameters) +727

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +160
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
   Sitecore.Web.UI.XamlSharp.Xaml.XamlControl.ExecuteAjaxMethod(AjaxMethodEventArgs e) +72
   Sitecore.Web.UI.XamlSharp.Xaml.XamlControl.Sitecore.Web.UI.XamlSharp.Ajax.IIsAjaxEventHandler.HandleMethodEvent(AjaxMethodEventArgs e) +33
   Sitecore.Web.UI.WebControls.AjaxScriptManager.DispatchMethod(Control control, String parameters) +319
   Sitecore.Web.UI.WebControls.AjaxScriptManager.Dispatch(String clientId, String parameters) +303
   Sitecore.Web.UI.XamlSharp.Ajax.AjaxContinuationProcessor.Invoke(PipelineArgs args) +370
   Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline) +225
   Sitecore.Pipelines.Pipeline.Resume() +38
   Sitecore.Pipelines.Pipeline.DoStart(PipelineArgs args) +115
   Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic) +169
   Sitecore.Web.UI.WebControls.ContinuationManager.RunPipelines() +306
   Sitecore.Web.UI.WebControls.ContinuationManager.OnPreRender(EventArgs e) +307
   System.Web.UI.Control.PreRenderRecursiveInternal() +88
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Control.PreRenderRecursiveInternal() +160
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +883

The following message is written to the Sitecore log when the error occurs:

2019-05-10T09:22:48  PID[8228] Error       8816 09:22:48 ERROR Application error.Exception: System.Web.HttpUnhandledExceptionMessage: Exception of type 'System.Web.HttpUnhandledException' was thrown.Source: System.Webat System.Web.UI.Page.HandleError(Exception e)at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)at System.Web.UI.Page.ProcessRequest()at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)at System.Web.UI.Page.ProcessRequest(HttpContext context)at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)Nested ExceptionException: System.Reflection.TargetInvocationExceptionMessage: Exception has been thrown by the target of an invocation.Source: mscorlibat System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)at Sitecore.Web.UI.XamlSharp.Xaml.XamlControl.ExecuteAjaxMethod(AjaxMethodEventArgs e)at Sitecore.Web.UI.XamlSharp.Xaml.XamlControl.Sitecore.Web.UI.XamlSharp.Ajax.IIsAjaxEventHandler.HandleMethodEvent(AjaxMethodEventArgs e)at Sitecore.Web.UI.WebControls.AjaxScriptManager.DispatchMethod(Control control, String parameters)at Sitecore.Web.UI.WebControls.AjaxScriptManager.Dispatch(String clientId, String parameters)at Sitecore.Web.UI.XamlSharp.Ajax.AjaxContinuationProcessor.Invoke(PipelineArgs args)at Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline)at Sitecore.Pipelines.Pipeline.Resume()at Sitecore.Pipelines.Pipeline.DoStart(PipelineArgs args)at Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic)at Sitecore.Web.UI.WebControls.ContinuationManager.RunPipelines()at Sitecore.Web.UI.WebControls.ContinuationManager.OnPreRender(EventArgs e)at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)Nested ExceptionException: System.InvalidOperationExceptionMessage: element is nullSource: Sitecore.Clientat Sitecore.Shell.Applications.Rules.RulesEditor.RulesEditorPage.Edit(String uid, String name, String control, String parameters)

We're using Sitecore.NET 9.0.0 (rev. 171002), running as an Azure app service.

Any thoughts?


Solution

  • So, it turns out the problem was that the "App_Browsers" folder was missing on the server. I replaced this folder, restarted the web app and the problem seems to be fixed.