Page 1 of 1

The provider did not create a CommandDefinition

Posted: Wed 09 Sep 2015 17:58
by skoub
i have an intermittent problem. I get this error message in my application for no particular reason because when i call a refresh to this page, the problem disappear. The application can run for a few hours without problem and then decide to throw an exception. So i cannot give you a test projet for that particular reason.

I'm running my app with MVC5, Framework 4.5.2 and Devart v8.5.478.0 (also tried with v8.4.359.0).

Code: Select all

System.Data.Entity.Core.ProviderIncompatibleException: The provider did not create a CommandDefinition. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Devart.Common.Entity.ag.a(br A_0, br A_1)
   at Devart.Common.Entity.ep.a(ah A_0, DbCommand A_1)
   at Devart.Common.Entity.e6.a(ah A_0, DbCommandBase A_1)
   at Devart.Common.Entity.e6.c()
   at Devart.Data.Oracle.Entity.OracleEntityProviderServices.CreateDbCommandDefinition(DbProviderManifest baseProviderManifest, DbCommandTree commandTree)
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
   at StackExchange.Profiling.Data.EFProfiledDbProviderServices`1.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree)
   at System.Data.Entity.Core.Common.DbProviderServices.CreateCommand(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree commandTree)
   at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(Dictionary`2 identifierValues)
   at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary`2 identifierValues, List`1 generatedValues)
   at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
   at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
   at System.Data.Entity.Internal.InternalContext.SaveChanges()
   at MTO.Sysgot.Web.Controllers.Pilotage.TypesOffresTouristiques.TypesOffresTouristiquesController.Add(Boolean isRepertoire, Nullable`1 typeOffreTouristiqueParentId, TypeOffreFormViewModel typeOffreFormViewModel)
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Re: The provider did not create a CommandDefinition

Posted: Fri 11 Sep 2015 09:02
by Shalex
1. Turn on the dbMonitor tool. Is there any failed SQL statement in dbMonitor when the application throws the ArgumentOutOfRangeException?
2. Please try to localize the issue and send us a small test project with the corresponding DDL/DML script for reproducing.

Re: The provider did not create a CommandDefinition

Posted: Mon 14 Sep 2015 13:07
by skoub
Its difficult to trap the error because it's intermittent but i can confirm that the sql statement is not sent to the database (dbMonitor).

Re: The provider did not create a CommandDefinition

Posted: Tue 15 Sep 2015 14:32
by Shalex

Code: Select all

...
   at MTO.Sysgot.Web.Controllers.Pilotage.TypesOffresTouristiques.TypesOffresTouristiquesController.Add(Boolean isRepertoire, Nullable`1 typeOffreTouristiqueParentId, TypeOffreFormViewModel typeOffreFormViewModel)
...
Looks like your code creates and adds new object/objects, saves them in DbContext/ObjectContext using SaveChanges(). I.e. you can extract all EF model files (code of model, classes, xml files if any) and connection string from your huge project. Then add these files to a separate newly created test application, implement a multithreading where each thread will add/save exactly the same object/objects which cause the fail.

This should be enough for reproducing. If so, please send us your test application with the corresponding DDL script for reproducing.