I have a very strange situation, exactly same site and code on server and developer machine. On server everything works fine, but on developer I encounter such a problem (details below). It happens if I assing a child class to parent, like:

void  MyMethod(Child child, ...)
Parent parentElement = new Parent();
parent.Title = "Something";
parent.Child = child; //error here

Microsoft.SharePoint.SPFieldMap.GetColumnNumber(String strFieldName, Boolean bThrow) w Microsoft.SharePoint.SPListItemCollection.GetColumnNumber(String groupName, Boolean bThrowException) w Microsoft.SharePoint.SPListItemCollection.GetRawValue(String fieldname, Int32 iIndex, Boolean bThrow) w Microsoft.SharePoint.SPListItem.GetValue(SPField fld, Int32 columnNumber, Boolean bRaw, Boolean bThrowException) w Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException) w Microsoft.SharePoint.SPListItem.get_Item(String fieldName) w Microsoft.SharePoint.Linq.PropertyMap.GetSPFieldValue(PropertyMap pm, SPListItem item, JoinPath joinPath) w Microsoft.SharePoint.Linq.PropertyMap.GetFromListItem(DataContext dc, SPListItem item, Object entity, JoinPath joinPath) w Microsoft.SharePoint.Linq.SPItemMappingInfo.MaterializeEntity[TEntity](DataContext dc, SPDataList list, SPListItem item, SPItemMappingInfo itemMappingInfo, JoinPath joinPath) w lambda_method(ExecutionScope , SPListItem ) w System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() w System.Collections.Generic.List1..ctor(IEnumerable1 collection) w Microsoft.SharePoint.Linq.EntitySet1.Load() w Microsoft.SharePoint.Linq.EntitySet1.Add(TEntity entity, Boolean fireEvents) w Microsoft.SharePoint.Linq.EntitySet1.Add(TEntity entity)

2 Answers 2


I have finally solved the problem! I have tracked the LOG and found that line:

Some lookup fields were omitted from the query results because the list exceeds the lookup column threshold. List URL: http://myserver/Listst/ListA


To solve it, go to Central Administrator -> Application management -> Manage Web Applications select one, then on top General Settings -> Resource Throttling there change default (8) List View Lookup Threshold value to a bigger one, in my case 12 was the lowest accepted value. Thats it! The LINQ message with "Value does not fall within the expected range" is not showing and everything works fine.


With a very limited code sample, it appears your issue is a general programming issue rather than SharePoint. Using the code sample provided, my guess is that child is coming in as null.

  • No, not at all, I've went through debugger and it is ok. Moreover what I've written at the beginning that same code and site (I've made backup / restore and deployed wsp) works correct on server machine. Maybe issue is connected with Service Pack 1 for SharePoint, I'm not sure...
    – christof
    Aug 25, 2011 at 21:04
  • Does Parent.child have the same type as child? Pretty limited to provide help on this one Aug 26, 2011 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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