How to debug invalid markup in a template?

Posted by Community Admin on 04-Aug-2018 12:58

How to debug invalid markup in a template?

All Replies

Posted by Community Admin on 18-Mar-2011 00:00

I've created a template (from the Sitefinity backend) and a few of pages based on that template. At some point I changed the template and saves/published the modifications. Now, when I open the template I get a yellow screen of death that says:

    [ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    Parameter name: index]
       System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) +11236150
       Telerik.Sitefinity.Web.UI.ZoneEditor.ProcessMisplacedControls() +1435
       Telerik.Sitefinity.Web.UI.ZoneEditor.CreateChildControls() +82
       System.Web.UI.Control.EnsureChildControls() +182
       System.Web.UI.Control.PreRenderRecursiveInternal() +60
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4185

I suppose the Sitefinity template designer generated invalid markup somewhere (see the ProcessMisplacedControls method).

How do I investigate this this and how can I repair my template? Can I see the template markup somewhere to try and fix it manually?

Posted by Community Admin on 24-Mar-2011 00:00

Hello Sylvain,

The ProcessMisplacedControls method is not related to invalid markup. It is always called and is related to the logic of assembling the controls of the page. So, there is nothing wrong with it.

Are you using custom layouts or custom controls? Do you remember what you changed in the template before it gets broken?

Maybe you could try to change the template of the pages to a different one and reorder the controls manually? The template is not stored as markup and is deep in the database, so manual fix would need very good understanding of the database relations.



Best wishes,
Lyubomir Dokov
the Telerik team

Posted by Community Admin on 28-Mar-2011 00:00

Hi,

So what you are saying is that once a template is broken, there is not way to fix? That means I'll need to take database backup every time I'll change a template if I don't want to lose my work.

Thanks

Sylvain

Posted by Community Admin on 04-Apr-2011 00:00

Hi Sylvain,

Well, a template is not supposed to break in the first place. Everything is stored in the database and we use an ORM library so it is not a simple thing to see why a template is broken. We can do it, we have the source code and all the understanding of the DB relations, you may be able to do it somehow, but it's not something that is supposed to be doable by third party. Frequent backups are always recommended.

Anyway, I wasn't able to reproduce the problem, but I reviewed the code in the method that throws the exception. I changed something that could probably cause this, this change will be available in the Q1 release.

I hope that  this helps and I am sorry for the inconvenience.



All the best,
Lyubomir Dokov
the Telerik team

Posted by Community Admin on 04-Apr-2011 00:00

Hi,
Ok, thank you.
- Sylvain


Posted by Community Admin on 21-Feb-2012 00:00

Have this same issue ver 4.2 was there a hotfix released?

Type : System.ArgumentOutOfRangeException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Index must be within the bounds of the List.
Parameter name: index
Source : mscorlib
Help link :
ActualValue :
ParamName : index
Data : System.Collections.ListDictionaryInternal
TargetSite : Void Insert(Int32, T)
Stack Trace :    at System.Collections.ObjectModel.Collection`1.Insert(Int32 index, T item)
   at Telerik.Sitefinity.Web.UI.ZoneEditor.ProcessMisplacedControls()
   at Telerik.Sitefinity.Web.UI.ZoneEditor.CreateChildControls()
   at System.Web.UI.Control.EnsureChildControls()
   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)

This thread is closed