Exception while browsing webpart/widget properties

Tomasz Sikora asked on February 26, 2018 16:12

There is an exception in admin panel while browsing webpart or widget properties in certain order. Have a look at this video:

kentico admin panel exception

Following exact pattern produces the error. Moving through properties in different order does not break anything. Web part properties are using only kentico form controls. No custom code is present on the fields page. There are properties that use Url Selector, boolean and textboxes.

  • Kentico version is 11.0.6
  • Renaming categories does not help
  • Removing categories DOES help
  • If there is category between fields that have Rich Text Editor and Url Selector it breaks

This is from event log:

Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

Exception type: System.Web.HttpUnhandledException
Stack trace: 
at 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.ProcessRequest(HttpContext context)
at ASP.cmsmodules_admincontrols_pages_uipage_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\2662bd87\eda15a9c\App_Web_uipage.aspx.71dc965c.cvpcugfd.0.cs:line 0
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)

Message: Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

Exception type: System.Web.HttpException
Stack trace: 
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState)
at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
at System.Web.UI.Control.AddedControl(Control control, Int32 index)
at CMS.FormEngine.Web.UI.DivDefaultLayout.CreateField(FieldCreationArgs args)
at CMS.FormEngine.Web.UI.AbstractDefaultLayout.CreateCategory(List`1 formFields, FieldCreationArgs args)
at CMS.FormEngine.Web.UI.DivDefaultLayout.CreateCategory(List`1 formFields, FieldCreationArgs args)
at CMS.FormEngine.Web.UI.AbstractDefaultLayout.Load()
at CMS.FormEngine.Web.UI.DivDefaultLayout.Load()
at CMS.FormEngine.Web.UI.AbstractDefaultLayout.LoadLayout()
at CMS.FormEngine.Web.UI.BasicForm.LoadDefaultLayout()
at CMS.FormEngine.Web.UI.BasicForm.LoadData(IDataContainer data)
at CMS.FormEngine.Web.UI.BasicForm.ReloadData()
at CMSModules_AdminControls_Controls_Class_FieldEditor_ControlSettings.Reload(Boolean forceReloadCategories) in C:\dev\BlueRhino-2018\server\CMS\CMSModules\AdminControls\Controls\Class\FieldEditor\ControlSettings.ascx.cs:line 264
at CMSModules_AdminControls_Controls_Class_FieldEditor_FieldEditor.LoadControlSettings(String selectedFieldType) in C:\dev\BlueRhino-2018\server\CMS\CMSModules\AdminControls\Controls\Class\FieldEditor\FieldEditor.ascx.cs:line 3937
at CMSModules_AdminControls_Controls_Class_FieldEditor_FieldEditor.OnLoad(EventArgs e) in C:\dev\BlueRhino-2018\server\CMS\CMSModules\AdminControls\Controls\Class\FieldEditor\FieldEditor.ascx.cs:line 913
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Recent Answers


Trevor Fayas answered on February 27, 2018 05:03

I would submit this as a bug. I am curious if the categories between these fields is in the original form, if they match the original form, etc, but regardless as to why it's happening this definitely looks like some bug that they will need to fix.

I'll try to look into that ascx control's line and see what may be causing it tomorrow.

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on February 28, 2018 14:47

Okay i got a moment to take a look at line 913

it is:

LoadControlSettings(PreviousField);

which PreviousField is

private string PreviousField
    {
        get
        {
            return ValidationHelper.GetString(ViewState["PreviousValue"], string.Empty);
        }
        set
        {
            ViewState["PreviousValue"] = value;
        }
    }

So you aren't crazy, it looks like it leverages the previous field in it's loading of the control setting. This code hasn't really changed from V10 to V11, so i'm thinking that something is not setting this PreviousField in the viewstate properly. The error makes sense now, but my guess is Support will need to look into why selecting a Category header screws this up (probably sets a null to the PreviousValue or something).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.