Bug in Entity Screen Auto Command

Im redesigning my cash up screen so when i press my cash value denomination button a pop up key pad opens to type in the quantity of the denomination. this then updates the label widget underneath with the cash value

Sometimes when i press the auto command button i get this below error. so far it is random, i can press the same button after a restart and it doesnt happen, but will then happen when i press another button

@emre can you see what this issue is from the below error? Im using the latest beta version

-----------------------------
[General Info]

Application: SambaPOS
Version:     5.2.19
Region:      en
DB:          SQ
Machine:     RICKS-LAPTOP
User:        Rick
Date:        28/01/2019
Time:        03:18

User Explanation:

Rick said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.Reflection.TargetInvocationException
Message:     Exception has been thrown by the target of an invocation.
Source:      mscorlib
Stack Trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Inner Exception 1
Type:        System.Data.Entity.Infrastructure.CommitFailedException
Message:     An error was reported while committing a database transaction but it could not be determined whether the transaction succeeded or failed on the database server. See the inner exception and http://go.microsoft.com/fwlink/?LinkId=313468 for more information.
Source:      EntityFramework
Stack Trace: at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbTransactionDispatcher.Commit(DbTransaction transaction, DbInterceptionContext interceptionContext)
   at System.Data.Entity.Core.EntityClient.EntityTransaction.Commit()
   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.<>c__DisplayClass2a.<SaveChangesInternal>b__27()
   at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
   at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
   at System.Data.Entity.Internal.InternalContext.SaveChanges()
   at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
   at System.Data.Entity.DbContext.SaveChanges()
   at Samba.Infrastructure.Data.SqlData.EFWorkspace.CommitChanges()
   at Samba.Services.Implementations.SettingsModule.ProgramSettings.SaveChanges() in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\SettingsModule\ProgramSettings.cs:line 429
   at Samba.Services.Implementations.SettingsModule.SettingService.SaveProgramSettings() in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\SettingsModule\SettingService.cs:line 92
   at Samba.Presentation.ClientLibrary.Modules.SettingsModule.ActionProcessors.UpdateProgramSetting.UpdateSetting(ActionData actionData, String settingName, String updateType) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\SettingsModule\ActionProcessors\UpdateProgramSetting.cs:line 84
   at Samba.Presentation.ClientLibrary.Modules.SettingsModule.ActionProcessors.UpdateProgramSetting.Process(ActionData actionData, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\SettingsModule\ActionProcessors\UpdateProgramSetting.cs:line 26
   at Samba.Services.Common.RuleActionTypeRegistry.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Common\RuleActionTypeRegistry.cs:line 39
   at Samba.Services.Implementations.AutomationModule.AutomationService.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\AutomationService.cs:line 42
   at Samba.Services.Implementations.AutomationModule.ActionDataBuilder.<>c__DisplayClass13_0.<InvokeWith>b__0() in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\ActionDataBuilder.cs:line 76
   at System.Windows.Threading.Dispatcher.Invoke(Action callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
   at System.Windows.Threading.Dispatcher.Invoke(Action callback)
   at Samba.Services.Implementations.AutomationModule.ActionDataBuilder.InvokeWith(AppState appState, RuleExecutionContext context) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\ActionDataBuilder.cs:line 84
   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWithoutLogging(Object ruleData) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 125
   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWith(Object dataParameter) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 62
   at Samba.Services.Implementations.AutomationModule.NotificationService.NotifyEvent(String eventName, Object dataParameter, AppState appState) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\NotificationService.cs:line 26
   at CallSite.Target(Closure , CallSite , INotificationService , String , Object , AppState )
   at Samba.Services.Implementations.AutomationModule.CommandExecutionService.ExecuteAutomationCommand(AppState appState, String commandName, String commandValue, Object dataObject, Boolean background) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Services\Implementations\AutomationModule\CommandExecutionService.cs:line 75
   at Samba.Presentation.ClientLibrary.Modules.AutomationModule.VisibleAutomationModule.<OnInitialization>b__6_3(EventParameters`1 x) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\AutomationModule\VisibleAutomationModule.cs:line 67
   at Microsoft.Practices.Prism.Events.EventSubscription`1.InvokeAction(Action`1 action, TPayload argument)
   at Microsoft.Practices.Prism.Events.EventSubscription`1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments)
   at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments)
   at Microsoft.Practices.Prism.Events.CompositePresentationEvent`1.Publish(TPayload payload)
   at Samba.Presentation.Services.Common.ExtensionMethods.Publish[TEventsubject](TEventsubject eventArgs, String eventTopic, Action expectedAction)

Inner Exception 2
Type:        System.Data.SqlClient.SqlException
Message:     The transaction operation cannot be performed because there are pending requests working on this transaction.
Source:      .Net SqlClient Data Provider
Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel isoLevel, Int32 timeout, SqlInternalTransaction transaction, TdsParserStateObject stateObj, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransactionYukon(TransactionRequest transactionRequest, String transactionName, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalConnectionTds.ExecuteTransaction(TransactionRequest transactionRequest, String name, IsolationLevel iso, SqlInternalTransaction internalTransaction, Boolean isDelegateControlRequest)
   at System.Data.SqlClient.SqlInternalTransaction.Commit()
   at System.Data.SqlClient.SqlTransaction.Commit()
   at System.Data.Entity.Infrastructure.Interception.DbTransactionDispatcher.<Commit>b__c(DbTransaction t, DbTransactionInterceptionContext c)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)

-----------------------------

[Assembly Info]

mscorlib, Version=4.0.0.0
System, Version=4.0.0.0
Samba.Services, Version=1.0.0.0
Samba.Domain, Version=1.0.0.0
Samba.Infrastructure.Data, Version=1.0.0.0
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=1.0.0.0
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v16.2, Version=16.2.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v16.2, Version=16.2.13.0
DevExpress.Xpf.Grid.v16.2.Core, Version=16.2.13.0
System.Xaml, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
Samba.Infrastructure, Version=1.0.0.0
Microsoft.Practices.Prism, Version=4.0.0.0
System.Runtime.Serialization, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
DevExpress.Xpf.Core.v16.2, Version=16.2.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=1.0.0.0
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=1.0.0.0
ReachFramework, Version=4.0.0.0
EntityFramework, Version=6.0.0.0
FluentValidation, Version=3.4.0.0
NCalc, Version=1.3.8.0
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
DevExpress.Data.v16.2, Version=16.2.13.0
WindowsInput, Version=1.0.4.0

-----------------------------

[System Info]

Operating System
-Microsoft Windows 10 Pro
--CodeSet = 1252
--CSDVersion = 
--CurrentTimeZone = 0
--FreePhysicalMemory = 998216
--OSArchitecture = 64-bit
--OSLanguage = 2057
--ServicePackMajorVersion = 0
--ServicePackMinorVersion = 0
--Version = 10.0.17134

Machine
-RICKS-LAPTOP
--Manufacturer = Hewlett-Packard
--Model = HP 650 Notebook PC
--TotalPhysicalMemory = 4176769024
--UserName = RICKS-LAPTOP\Rick

-----------------------------

It looks like to happen when you want to save something to SQL server while it is saving something else. I guess it tries to save two program settings at a time. When you check from Management Studio is this setting enabled on database properties ?

OK nevermind. I disabled running two save requests at the same time. They’ll automatically run synchronized.

It will be available on next beta update. I’ll be glad if you can let me know if it solves the issue or not.

1 Like

Thanks Emre, will do :slight_smile: