Chr*_*anV 5 linq sharepoint-2010 linq-to-sharepoint
在我们的SharePoint 2010项目中,我们使用Linq to SharePoint来获取ConfigurationItems列表.在我们的测试环境中,我们从未从此列表中获取数据时遇到问题.在我们的生产环境中,我们现在有时(我们现在找不到模式)在循环遍历列表中的项时获取空引用异常.
以下是从Linq到SharePoint代码抛出的异常:
Object reference not set to an instance of an object. StackTrace: 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.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.Rules.PushDownProcessor.SelectWithInfoOp.Process(Context ctx) at Microsoft.SharePoint.Linq.Rules.GuardedRule`4.c__DisplayClass7.b__6(TSourceBase src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.CacheRule`3.Apply(TSource src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.b__0(Expression e, Context ctx) at Microsoft.SharePoint.Linq.Rules.ChildRule`2.Apply(TNode src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.PushDownProcessor.b__3(Expression e, Context ctx) at Microsoft.SharePoint.Linq.Rules.RewriteRule`2.Apply(TNode src, TContext ctx) at Microsoft.SharePoint.Linq.Rules.CacheRule`3.Apply(TSource src, TContext ctx) at Microsoft.SharePoint.Linq.SPLinqProvider.Rewrite(Expression expression, List`1& assumptions) at Microsoft.SharePoint.Linq.SPLinqProvider.RewriteAndCompile[T](Expression expression, List`1& assumptions) at Microsoft.SharePoint.Linq.LinqQuery`1.GetEnumerator() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Common.Configuration.ConfigurationRepository.GetConfiguration(String siteUrl) InnerException: Source: Microsoft.SharePoint.Linq TargetSite: Int32 GetHashCode()
这里是我们在GetConfiguration方法中使用的代码.
using (SpDataContext dataContext = new SpDataContext(siteUrl))
{
result = new ConfigurationModel()
{
Configurations = (from item in dataContext.GasportConfiguration
select new ConfigurationItem()
{
Key = item.Key,
Value = item.Value,
Environment = (Environment)Enum.Parse(typeof(Environment), item.Environment.ToString(), true)
}).ToList()
};
}
Run Code Online (Sandbox Code Playgroud)
任何人都有关于如何跟踪这个问题的想法?
更新31-05-2011:
我们找到了一种模式,通过这种模式,我们可以在生产环境中重现这种行为.而且在我们的测试环境中,我们也遇到了这个问题,我们使用AdPlus从中提取了一些Crash Dump文件.
我们看到在回收应用程序池后发生此行为.解决此错误的唯一方法是执行完整的IISreset.
在crashdump分析中,我发现了一条异常消息,指出:异常代码:0xC0000005异常信息:线程尝试读取或写入没有相应访问权限的虚拟地址.
希望有人能给我一些关于这个例外的更多信息吗?
遗憾的是,我们尚未找到此问题的解决方案,因此决定从 LINQ 迁移到 SharePoint。对于一些列表,我们已将其更改为 SQL 表 (Linq to SQL),对于 SharePoint 列表,我们移回 CAML。
归档时间: |
|
查看次数: |
3943 次 |
最近记录: |