This is just a dump of some notes I took during a typical SharePoint escapade. In this situation I was deploying a web template or feature related to page layouts. If the below seems similar to your case, this may help.

Errors

Server Error in ‘/’ Application.
Value does not fall within the expected range.
Exception Details: System.ArgumentException: Value does not fall within the expected range.

[ArgumentException: Value does not fall within the expected range.]
Microsoft.SharePoint.SPContentTypeId..ctor(String id) +38781198
Microsoft.SharePoint.Publishing.Fields.ContentTypeIdFieldValue.get_Id() +93
Microsoft.SharePoint.Publishing.PageLayout.get_AssociatedContentTypeId() +314
Microsoft.SharePoint.Publishing.PageLayout.get_AssociatedContentType() +180
Microsoft.SharePoint.Publishing.PageLayout.get_UIDisplayName() +559
Microsoft.SharePoint.Publishing.PageLayoutComparerByUIDisplayName.Compare(PageLayout x, PageLayout y) +34
System.Collections.Generic.ArraySortHelper`1.DepthLimitedQuickSort(T[] keys, Int32 left, Int32 right, IComparer`1 comparer, Int32 depthLimit) +72
System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +287

[InvalidOperationException: Failed to compare two elements in the array.]
System.Collections.Generic.ArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +14624514
System.Array.Sort(T[] array, IComparer`1 comparer) +88
Microsoft.SharePoint.Publishing.PublishingWeb.GetAvailableCachedPageLayouts() +438
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PageLayoutAction.GetJsonPageLayoutsInfo() +124
Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions.PageLayoutAction.PagePreRenderComplete(Object sender, EventArgs e) +282
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4628

Server Error in ‘/’ Application.
Failed to set value of the “Associated Content Type” column on the “Content Type ID” field type control.  See details in log. Exception message: Value does not fall within the expected range..
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.SharePoint.SPException: Failed to set value of the “Associated Content Type” column on the “Content Type ID” field type control.  See details in log. Exception message: Value does not fall within the expected range..

Solution:

In my particular case the issue was related to a content type id being mistyped for the page layout. Check your references to content type id’s with the particular item that is causing this error. In my case I had entered 00x{CT_guid} and not 0x{CT_guid}

No Comments

There are no comments related to this article.