I have a RANDOM error (1 of 100 page loads) in the following line of code:
topic = TopicsContext.GetCurrentDataContext().tTopics.Where(t => t.ContentId == contentId).SingleOrDefault();
Both the ContentId property and the conntentId local variables are long.
Most importantly, the error occurs randomly, in most cases it works fine.
Thanks in advance for your ideas.
Here is the complete exception information:
Error Message: Specified cast is not valid.
Error Source: System.Data.Linq
Error Stack Trace:
at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
at Topics.BusinessLogic.Models.Services.TopicService.GetTopic(String title) in C:\rabota\topics\source\trunk\Topics.BusinessLogic\Models\Services\TopicService.cs:line 65
Sergey Osypchuk
source
share