none
An unhandled exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in mscorlib.dll RRS feed

  • Question

  • Hello,

    I'm facing strange issue. First of all fast disclaimer:

    1. I have backup version of my app from 27.12.17, and 03.01.17, and I'm sure everything was working fine on 27.12.17.

    2. I'm trying to develop WPF app with Entity Framework and SQL Database (it's Database-First)

    3. My db context is updated and working just fine.

    Ok, so for siplicity, I have 2 buttons. 1 button leads me to page with Clients View (from sql db), second one leads me to page with Products View. Navigation and constructors are the same for both (I mean, specific for those classes, but very simillar). When I press button to Clients navigation, I'm beeing navigated, when I press Products button, I'm getting this:

    An unhandled exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in mscorlib.dll

    Stack trace:

       w System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
       w System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClassb.<GetResults>b__a()
       w System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClassb.<GetResults>b__9()
       w System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
       w System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
       w System.Lazy`1.CreateValue()
       w System.Lazy`1.LazyInitValue()
       w System.Lazy`1.get_Value()
       w System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
       w Telerik.Windows.Data.QueryableExtensions.Aggregate(IQueryable source, IEnumerable`1 aggregateFunctions)
       w Telerik.Windows.Controls.GridView.GridViewDataControl.CreateAggregateResults()
       w Telerik.Windows.Controls.GridView.GridViewDataControl.CalculateAggregates()
       w Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
       w Telerik.Windows.Controls.DataControl.OnItemsCollectionChangedDispatch(Object sender, NotifyCollectionChangedEventArgs e)
       w System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
       w Telerik.Windows.Data.DataItemCollection.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
       w Telerik.Windows.Data.DataItemCollection.RaiseChangeEvents()
       w Telerik.Windows.Data.DataItemCollection.SetItemsSource(IEnumerable source, Type type)
       w Telerik.Windows.Controls.GridView.GridViewDataControl.<>c__DisplayClass33.<Bind>b__32()
       w Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(FrameworkElement frameworkElement, Action action)
       w Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(Object newValue)
       w Telerik.Windows.Controls.GridView.GridViewDataControl.OnApplyTemplate()
       w System.Windows.FrameworkElement.ApplyTemplate()
       w System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       w System.Windows.UIElement.Measure(Size availableSize)
       w System.Windows.Controls.Grid.MeasureOverride(Size constraint)
       w System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       w System.Windows.UIElement.Measure(Size availableSize)
       w MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
       w System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
       w System.Windows.FrameworkElement.MeasureCore(Size availableSize)
       w System.Windows.UIElement.Measure(Size availableSize)
       w System.Windows.ContextLayoutManager.UpdateLayout()
       w System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
       w System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
       w System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       w System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       w System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       w System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       w System.Windows.Threading.DispatcherOperation.InvokeImpl()
       w System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       w System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       w MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
       w System.Windows.Threading.DispatcherOperation.Invoke()
       w System.Windows.Threading.Dispatcher.ProcessQueue()
       w System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       w MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       w MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       w System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       w System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
       w System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       w MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       w MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       w System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       w System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       w System.Windows.Application.RunDispatcher(Object ignore)
       w System.Windows.Application.RunInternal(Window window)
       w System.Windows.Application.Run(Window window)
       w System.Windows.Application.Run()
       w Iglotex.App.Main() w c:\Users\(...)\obj\x86\Debug\App.g.cs:wiersz 0
       w System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       w System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       w Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       w System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       w System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       w System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       w System.Threading.ThreadHelper.ThreadStart()

    InnerException Stack Trace:

       w System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       w System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
       w System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
       w System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
       w System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
       w System.Data.SqlClient.SqlDataReader.get_MetaData()
       w System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption)
       w System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
       w System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
       w System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       w System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       w System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
       w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c__DisplayClassb.<Reader>b__8()
       w System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TInterceptionContext,TResult](Func`1 operation, TInterceptionContext interceptionContext, Action`1 executing, Action`1 executed)
       w System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
       w System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
       w System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
       w System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)

    HResult: -2146232060

    InnerException: {"Upłynął limit czasu wykonywania. Limit upłynął przed ukończeniem operacji lub serwer nie odpowiada."} (quick translation to English: Timeout)

    What is wierd, I've changed nothing in this class since 27.12.17 and it was working fine. If you have no clue what causes the problem, maybe tell me if I should look for answers in my project setup, in database or just in code. 1 more wierd thing - sometimes this button works, sometimes it doesn't (mostly doesn't). 

    Thanks in advance!

    Thursday, January 4, 2018 3:02 PM

All replies

  • Hi Vanghern,

    Based on your description and related, it seems that database's statistics and/or query plan cache are incorrect, please clear the statistics by using the following statement.

    exec sp_updatestats

    If it doesn't work, please try:

    dbcc freeproccache

    If the issue still exist, could you please share a simple demo which could reproduce the issue via OneDrive.

    Note: Please remove the privacy information before you upload the demo. 

    Best regards,

    Zhanglong


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 5, 2018 7:04 AM
    Moderator
  • Hello Zhanglong,

    I'm not allowed to do this on our DB, so I got to wait for my boss (like 2h), what is new in my case - Client list doesn't load now as well. Also I can't really make a demo, because to reproduce the problem, you need connection string and db structure, right? 

    EDIT:

    I've just loaded both lists twice. 

    • Edited by Vanghern Friday, January 5, 2018 8:22 AM
    Friday, January 5, 2018 8:21 AM
  • It looks like we have internal RAM problem, due to Oracle db running on our server. So It looks like I've done nothing wrong and it's not my fault. Thanks for your help Zhanglong!
    Friday, January 5, 2018 3:45 PM