我在 8 到 12 次页面重新加载时随机出现 2 个异常 - 其中异常也是随机的,可能是第一,也可能是第二。例外情况如下
[IndexOutOfRangeException: Index was outside the bounds of the array.]
System.Data.SqlClient.SqlDataReader.ReadColumnHeader(Int32 i) +701
System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i) +29
Read_BoardMessage(ObjectMaterializer`1 ) +348
System.Data.Linq.SqlClient.ObjectReader`2.MoveNext() +42
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +472
System.Linq.Enumerable.ToList(IEnumerable`1 source) +80
Website.BusinessLogic.Services.BoardMessageService.GetBoardMessageModelsFromQuery(IQueryable`1 boardMessagesQuery) in D:\Applications\Website.BusinessLogic\Services\BoardMessageService.cs:167
Website.BusinessLogic.Services.<>c__DisplayClass6.<GetStudentsBoardMessages>b__5() in D:\Applications\Website.BusinessLogic\Services\BoardMessageService.cs:89
Library.Web.Utilities.RequestScopeCache.Get(String key, Func`1 defaultGetter) in D:\APPLICATIONS\Library\Web\Utilities\RequestScopeCache.cs:66
Website.BusinessLogic.Services.BoardMessageService.GetStudentsBoardMessages(Int32 classId) in D:\Applications\Website.BusinessLogic\Services\BoardMessageService.cs:89
Website.Web.usercontrols.ShowMessages.Initialize() in D:\Applications\Website.Web\usercontrols\ShowMessages.ascx.cs:28
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
- - - 和 - - -
[InvalidOperationException: Sequence contains more than one element]
System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) +4539
System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) +207
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) +500
System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression) +41
System.Linq.Queryable.Count(IQueryable`1 source) +352
Website.Web.usercontrols.TopMenu.SetStudentMenu() in D:\Applications\Website.Web\usercontrols\TopMenu.ascx.cs:93
Website.Web.usercontrols.TopMenu.IsLoggedIn() in D:\Applications\Website.Web\usercontrols\TopMenu.ascx.cs:60
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Control.LoadRecursive() +190
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064
堆栈跟踪指向以下代码
using (var dataContext = new MyDataContext(Config.ConnectionString))
{
int numberOfBoardMessages = dataContext.BoardMessages.
Where(boardMessage => boardMessage.BoardMessageClasses.
Any(boardMessageClass => boardMessageClass.ClassId == currentClassId) && boardMessage.IsPublished).
Count();
}
我尝试使用没有“BoardMessages”的空白数据库,但错误仍然存在。有没有人对可能是什么问题有任何想法?