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 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)

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 '11 at 21:04
    
Does Parent.child have the same type as child? Pretty limited to provide help on this one –  Tim Gabrhel Aug 26 '11 at 2:26
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.