I have RANDOM error (1 from 100 page loads) in following line of code:
topic = TopicsContext.GetCurrentDataContext().tTopics.Where(t => t.ContentId == contentId).SingleOrDefault();
Both ContentId property and conntentId local variables are long.
Most important - error occurs randomly, in most cases it works fine.
Thanks in advance for you ideas
Here is full Exception info:
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