This is a migrated thread and some comments may be shown as answers.

Exception "Attempted to read past the end of the stream"

1 Answer 906 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
João
Top achievements
Rank 1
João asked on 10 Dec 2012, 07:48 AM
I've tried retrieving the # of rows in a table using LINQ

[HttpPost]
public ActionResult CheckLogin(string value)
{
    using (var db = new Database()) // Context
    {
        var count = (from account in db.Accounts
                    where account.Login.ToLower() == value.ToLower()
                    select account).Count();
        if (count > 0)
        {
            return Json("Login is already in use.");
        }
        return Json(true);
    }
}

but, sometimes it works and sometimes it fails with an exception "Attempted to read past the end of the stream."
this is happening locally (IIS express + VS2012 Update 1) connected to a remote MySQL Server (5.1.54)

I have no idea why this is happening... here's the callstack of the exception.

[DataStoreException: Attempted to read past the end of the stream.] Telerik.OpenAccess.SPI.Backends.ThrowException(Exception e) +28 OpenAccessRuntime.ExceptionWrapper.Throw() +42 OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.executeQueryAll(ApplicationContext context, ImmutableQueryDetails query, CompiledQuery compiledQuery, QueryParameters parameters, Int32 skip, Int32 take) +544 OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.getAllQueryResults(CompiledQuery cq, QueryParameters parameters, Int32 skip, Int32 take) +87 OpenAccessRuntime.DataObjects.OpenAccessQueryImp.executeWithArrayImp(Object[] parameters) +1810 OpenAccessRuntime.DataObjects.OpenAccessQueryImp.executeWithArray(Object[] parameters) +401 OpenAccessRuntime.QueryResultImpl.check() +123 OpenAccessRuntime.QueryResultImpl.GetEnumerator() +73 OpenAccessRuntime.QueryResultImpl.System.Collections.IEnumerable.GetEnumerator() +41 Telerik.OpenAccess.Query.ExpressionExecution.PerformDatabaseQuerySingle(ChainedContext context, Expression expression, QueryableCategory before, Int32& found, Int32 elemAt, Boolean single, Boolean diffType) +529 Telerik.OpenAccess.Query.ExpressionExecution.PerformQuerySingle(ExpressionCutter cutter, MethodCallExpression mce, ChainedContext piece) +608 Telerik.OpenAccess.Query.Piece`1.ExecuteSingle(Expression expression) +424 Telerik.OpenAccess.Query.Piece`1.System.Linq.IQueryProvider.Execute(Expression expr) +80 System.Linq.Queryable.Count(IQueryable`1 source, Expression`1 predicate) +265 Website.Controllers.PreviewController.CheckLogin(String value) in d:\Projects\website\portal\trunk\Project\Website\Controllers\PreviewController.cs:45 lambda_method(Closure , ControllerBase , Object[] ) +180 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +211 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +48 System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +57 System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +223 System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +48 System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24 System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


Any ideas on how to solve this?

1 Answer, 1 is accepted

Sort by
0
Viktor Zhivkov
Telerik team
answered on 10 Dec 2012, 11:13 AM
Hello João,

We are unable to reproduce the issue with the failing count query in our test environment.

Can you isolate the problem reproduction code into a complete solution including you domain model and send it back to us?

Kind regards,
Viktor Zhivkov
the Telerik team
Telerik OpenAccess ORM Meets ASP.NET Web API. Read more.
Tags
General Discussions
Asked by
João
Top achievements
Rank 1
Answers by
Viktor Zhivkov
Telerik team
Share this question
or