Hello,
I am using Linq2SharePoint in my SharePoitn solution quite often. The application runs fine in my local test environment, but on the production server I receive unregulary (sometimes only 2 days) following exception:
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Linq.FieldRef.GetHashCode() at Microsoft.SharePoint.Linq.FieldRef.FieldRefEqualityComparer.GetHashCode(FieldRef obj) at System.Linq.Set`1.InternalGetHashCode(TElement value) at System.Linq.Set`1.Find(TElement value, Boolean add) at System.Linq.Enumerable.<DistinctIterator>d__7a`1.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Microsoft.SharePoint.Linq.SelectMappingInfo.GetDistinctMappedFields() at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.SelectWithInfoOp.PushDownSelect(Context ctx) at Microsoft.SharePoint.Linq... c1f7652f-a764-4661-b7d1-4426388b6a94
This is caused by following code line:
public IEnumerable<PersonsContentType> GetPersonsnAll(string url) { IEnumerable<Persons> personFields;using (var ctx = new DataContext(url)) { ctx.ObjectTrackingEnabled = false; personFields = (from x in ctx.Application where x.Status != ProcessStatus.Deleted orderby x.CreatedOn descendingselect x).ToList(); }return personFields; }
Only if I do an IISReset everythink works fine again.
Do you have any idea wha this could be?