Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a custom master based on Just The Essentials.master by Heather Solomon. When I apply it to a publising page it displays fine. When I go to edit mode I get the following:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index 

[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.ThrowHelper.ThrowArgumentOutOfRangeException() +78
   System.Collections.Generic.List`1.get_Item(Int32 index) +53
   Microsoft.SharePoint.SPFieldMultiColumnValue.get_Item(Int32 index) +62
   Microsoft.SharePoint.Publishing.PageLayout.get_AssociatedContentTypeId() +153
   Microsoft.SharePoint.Publishing.PageLayout.get_AssociatedContentType() +75
   Microsoft.SharePoint.Publishing.PageLayout.get_UIDisplayName() +239
   Microsoft.SharePoint.Publishing.PageLayoutComparerByUIDisplayName.Compare(PageLayout x, PageLayout y) +20
   System.Collections.Generic.ArraySortHelper`1.SwapIfGreaterWithItems(T[] keys, IComparer`1 comparer, Int32 a, Int32 b) +153
   System.Collections.Generic.ArraySortHelper`1.QuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer) +186
   System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +216

[InvalidOperationException: Failed to compare two elements in the array.]
   System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +10151111
   System.Array.Sort(T[] array, Int32 index, Int32 length, IComparer`1 comparer) +299
   System.Array.Sort(T[] array, IComparer`1 comparer) +86
   Microsoft.SharePoint.Publishing.PublishingWeb.GetAvailableCachedPageLayouts() +353
   Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PageLayoutAction.GetJsonPageLayoutsInfo() +105
   Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PageLayoutAction.OnPreRender(EventArgs e) +275
   System.Web.UI.Control.PreRenderRecursiveInternal() +108
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Control.PreRenderRecursiveInternal() +224
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

If I could see the line it was pointing to in my code I could work it out. I guess I could be missing a control? How would you go about debugging this?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Judging by the stack trace, I'm more inclined to think that a control is being included that shouldn't be or that it is referring to a field that does not exist. Look in your master page and page layout for a Publishing field and make sure that the field it mentions actually exists in the underlying list. Remember to use the actual name of the field, not the display name.

I have not used Heather's master page as a starting point (though she normally does fantastic work) but have had great success with the Starter Master page on Codeplex

share|improve this answer
    
I tried swapping out the masterpage for the Randy's one (publishing and foundation) and I still get the error. –  John Oct 25 '11 at 8:36
    
It looks like when I turn a custom feature on the publishing site it causes it to crash. Once it crashed it stays crashed even if the feature is turned off. –  John Oct 25 '11 at 8:46
    
Does the problem go away if you use the default v4.master? If the page layout used by the page is customized, you might want to check that as well. –  Dave Wise Oct 25 '11 at 14:25
    
I had a rogue featurew causing the issue. Deleting the feature fixed the problem. –  John Oct 25 '11 at 14:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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