Shutdown when trying to update Program Setting

Has anyone experienced these errors when trying to update a program setting? I just started getting this today for some reason.

—Edit----
After troubleshooting a bit it appears it’s only happening for one specific Global Program Setting. I did try updating this setting via GQL today… I didn’t get any errors when I did that but hmmm…I wonder if there is an issue there?

4/7/2024 10:55 PMed

[General Info]

Application: SambaPOS
Version: 5.7.2
Region: en
DB: SQ
Machine: CDBSERVER
User: ServerAdmin
Date: 4/8/2024
Time: 3:55 AM

User Explanation:

ServerAdmin said “”

[Exception Info 1]

Top-level Exception
Type: Microsoft.Practices.Prism.Regions.ViewRegistrationException
Message: An exception has occurred while trying to add a view to region ‘MainRegion’.
- The most likely causing exception was was: ‘System.InvalidOperationException: View already exists in region.
at Microsoft.Practices.Prism.Regions.Region.InnerAdd(Object view, String viewName, IRegionManager scopedRegionManager)
at Microsoft.Practices.Prism.Regions.Region.Add(Object view, String viewName, Boolean createRegionManagerScope)
at Microsoft.Practices.Prism.Regions.Region.Add(Object view)
at Microsoft.Practices.Prism.Regions.Behaviors.AutoPopulateRegionBehavior.AddViewIntoRegion(Object viewToAdd)
at Microsoft.Practices.Prism.Regions.Behaviors.AutoPopulateRegionBehavior.OnViewRegistered(Object sender, ViewRegisteredEventArgs e)’.
But also check the InnerExceptions for more detail or call .GetRootException().
Source: Microsoft.Practices.Prism
Stack Trace: at Microsoft.Practices.Prism.Regions.RegionViewRegistry.OnContentRegistered(ViewRegisteredEventArgs e)
at Microsoft.Practices.Prism.Regions.RegionViewRegistry.RegisterViewWithRegion(String regionName, Func1 getContentDelegate) at Microsoft.Practices.Prism.Regions.RegionViewRegistry.RegisterViewWithRegion(String regionName, Type viewType) at Microsoft.Practices.Prism.Regions.RegionManagerExtensions.RegisterViewWithRegion(IRegionManager regionManager, String regionName, Type viewType) at Samba.Presentation.ClientLibrary.Modules.TimeClockModule.TimeClockModule.OnInitialization() at Samba.Presentation.Common.StagedSequenceService1.ProcessSequence(ILogService logService)

Inner Exception 1
Type: System.InvalidOperationException
Message: View already exists in region.
Source: Microsoft.Practices.Prism
Stack Trace: at Microsoft.Practices.Prism.Regions.Region.InnerAdd(Object view, String viewName, IRegionManager scopedRegionManager)
at Microsoft.Practices.Prism.Regions.Region.Add(Object view, String viewName, Boolean createRegionManagerScope)
at Microsoft.Practices.Prism.Regions.Region.Add(Object view)
at Microsoft.Practices.Prism.Regions.Behaviors.AutoPopulateRegionBehavior.AddViewIntoRegion(Object viewToAdd)
at Microsoft.Practices.Prism.Regions.Behaviors.AutoPopulateRegionBehavior.OnViewRegistered(Object sender, ViewRegisteredEventArgs e)


[Assembly Info]

mscorlib, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
System, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
Samba.Services, Version=5.7.8690.38150
System.ComponentModel.Composition, Version=4.0.0.0
System.Configuration, Version=4.0.0.0
DevExpress.Xpf.Core.v17.2, Version=17.2.13.0
System.Xaml, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
Samba.Presentation.Services, Version=5.7.8690.38152
Samba.Presentation.Common, Version=5.7.8690.38156
System.Drawing, Version=4.0.0.0
Samba.Domain, Version=5.7.8690.38148
Microsoft.Practices.Prism, Version=4.0.0.0
Samba.Infrastructure, Version=5.7.8690.38145
System.Core, Version=4.0.0.0
DevExpress.Data.v17.2, Version=17.2.13.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
Samba.Localization, Version=5.3.8690.38146
Samba.Persistance, Version=5.7.8690.38149
FastButton, Version=1.0.0.0


[System Info]

Operating System
-Microsoft Windows Server 2022 Standard
–CodeSet = 1252
–CSDVersion =
–CurrentTimeZone = -300
–FreePhysicalMemory = 3467416
–OSArchitecture = 64-bit
–OSLanguage = 1033
–ServicePackMajorVersion = 0
–ServicePackMinorVersion = 0
–Version = 10.0.20348

Machine
-CDBSERVER
–Manufacturer = HP
–Model = ProLiant DL320e Gen8 v2
–TotalPhysicalMemory = 8553734144
–UserName =


######################### E N D #########################
4/7/2024 10:57 PM

[General Info]

Application: SambaPOS
Version: 5.7.2
Region: en
DB: SQ
Machine: CDBSERVER
User: ServerAdmin
Date: 4/8/2024
Time: 3:57 AM

User Explanation:

ServerAdmin 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.InvalidOperationException
Message: Sequence contains more than one element
Source: System.Core
Stack Trace: at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source) at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.<>c__141.b__14_2(IEnumerable1 sequence) at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable1 query, Expression queryRoot)
at System.Data.Entity.Core.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable1 source) at Samba.Infrastructure.Data.SqlData.EFWorkspace.Single[T](Expression1 expression, Expression1[] includes) at Samba.Services.Implementations.SettingsModule.ProgramSettings.GetSetting(String valueName) at Samba.Services.Implementations.SettingsModule.SettingService.ReadGlobalSetting(String settingName) at ​ .(ActionData , String , String ) at ​ .Process(ActionData , RuleExecutionContext ) at Samba.Services.Common.RuleActionTypeRegistry.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) at Samba.Services.Implementations.AutomationModule.AutomationService.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) at Samba.Services.Implementations.AutomationModule.ActionDataBuilder.<>c__DisplayClass13_0.<InvokeWith>b__0() 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) at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWithoutLogging(Object ruleData) at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWith(Object dataParameter) at Samba.Services.Implementations.AutomationModule.NotificationService.NotifyEvent(String eventName, Object dataParameter, AppState appState) 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) at nnbxcqsyu6gvkaz. .(EventParameters1 )
at Microsoft.Practices.Prism.Events.EventSubscription1.InvokeAction(Action1 action, TPayload argument)
at Microsoft.Practices.Prism.Events.EventSubscription1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments) at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments) at Microsoft.Practices.Prism.Events.CompositePresentationEvent1.Publish(TPayload payload)
at Samba.Presentation.Services.Common.ExtensionMethods.Publish[TEventsubject](TEventsubject eventArgs, String eventTopic, Action expectedAction)


[Assembly Info]

mscorlib, Version=4.0.0.0
System, Version=4.0.0.0
Samba.Services, Version=5.7.8690.38150
Samba.Domain, Version=5.7.8690.38148
Samba.Infrastructure.Data, Version=5.7.8690.38148
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=5.7.8690.38152
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v17.2, Version=17.2.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v17.2, Version=17.2.13.0
DevExpress.Xpf.Grid.v17.2.Core, Version=17.2.13.0
System.Xaml, Version=4.0.0.0
Samba.Infrastructure, Version=5.7.8690.38145
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.v17.2, Version=17.2.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=5.7.8690.38149
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=5.3.8690.38146
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.v17.2, Version=17.2.13.0
WindowsInput, Version=1.0.4.0


[System Info]

Operating System
-Microsoft Windows Server 2022 Standard
–CodeSet = 1252
–CSDVersion =
–CurrentTimeZone = -300
–FreePhysicalMemory = 3279916
–OSArchitecture = 64-bit
–OSLanguage = 1033
–ServicePackMajorVersion = 0
–ServicePackMinorVersion = 0
–Version = 10.0.20348

Machine
-CDBSERVER
–Manufacturer = HP
–Model = ProLiant DL320e Gen8 v2
–TotalPhysicalMemory = 8553734144
–UserName =


######################### E N D #########################

Can you share a screenshot of the whole un-wrapped action in the Rule?

Are you passing any odd Unicode characters?

The first exception seems unlikely to be thrown by anything to do with program settings. If this exception persists, it may warrant a look into by support as I’m doubtful it’s something a user could trigger.

The second’s inner exception leads me to think there may be more than one program setting with the same name.

Run this in SSMS and see if it returns any results:

SELECT Name,
       COUNT(1)
    FROM dbo.ProgramSettingValues
    GROUP BY Name
    HAVING COUNT(1) > 1;

This will remove duplicates (then make sure the remaining setting has the value you want):

WITH CTE (Name, Count)
AS (
   SELECT Name,
          ROW_NUMBER() OVER (PARTITION BY Name ORDER BY Id) AS Count
       FROM dbo.ProgramSettingValues
   )
DELETE FROM CTE
    WHERE Count > 1;

I think updating your SambaPOS installation will solve this problem.

The result is:
MP_MemberPhoto_Global 6

Results in:

(5 rows affected)

Completion time: 2024-04-08T16:11:26.2633677-05:00

No. It’s a web address that I’m updating it to.


Thanks Memo that worked! To the rescue again!

On a similar topic: Can you think of a reason why when I update a program setting in Samba It doesn’t change when retrieved via GraphQL? My thought was something to do with cache but I’m not sure how avoid that?

Thanks again and again and again… haha.

Yep you had 6 entries for MP_MemberPhoto_Global setting.

What GQL query are you using?

I recall there being an issue with global settings - I’m not sure if it was getting or setting them.

It may be easier to just hit the db with a query so you know you’ll have the most recent value.

Keep in mind, also, there can be race conditions setting global settings. If multiple terminals are trying to set the same value for a setting at the same time, you don’t really know which one will end up as the final value.

EDIT

So poking around, the GQL query to getGlobalSetting uses the same way of retrieving a global setting as the desktop application does and yes, there is a cache. I’m not sure what that cache settings are. Which brings me to this:

There are two hard problems in programming:

  • naming things
  • cache invalidation
  • off-by-one errors

Thanks for the info!

hmm… that definitely poses a problem because I need to pull global settings from GQL for my setup. What’s happening is the setting is set by the desktop app. It’s then retrieved from within the desktop app using an HTML widget. (I’m trying to add photos to my member portal) This s the last workaround I can come up with to get photos in my entity screens for member photos so all my eggs are in this basket.

I seem to have the best luck accomplishing this by setting the setting in Samba, then clearning the cache in firefox and loading a private window, then pulling up the page that displays the photo. But even then it only works about half the time. It registers that I delete the program settting nearly instantly but when resetting it i get null over and over. My final troubleshooting idea was to attempt setting the program setting with GQL instead of the desktop app but that resulted in the crashes.