SQL error Object reference not set to an instance of an object

I have a setup with one server and one terminal. It was working fine then when I went to edit a menu on the server I get a flashing error box with the message “Object reference not set to an instance of an object.”. This appears to be flashing as though the system encounters an error and keeps retrying. This is confirmed by the error log which has multiple repetitions of the same error.

When I connect to the server from the terminal I can edit the menu with no problem. When I disconnect the network and try to edit at the server the problem is still there which implies it is a local issue at the server. The error report is as follows, any suggestions would be most welcome.

8/10/2018 10:15 PM

[General Info]

Application: SambaPOS
Version: 5.2.7
Region: en
Machine: OGB-ON-13-SERVE
User: OGB_System
Date: 8/10/2018
Time: 3:15 PM

User Explanation:

OGB_System said “”

[Exception Info 1]

Top-level Exception
Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Samba.Presentation.ClientLibrary
Stack Trace: at Samba.Presentation.ClientLibrary.Modules.PosModule.SubButtonColorDef.AreColorsValid(String colorDef) in C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\PosModule\SubButtonColorDef.cs:line 67
at Samba.Management.MenuModule.ScreenMenuValidatior.<>c.<.ctor>b__0_5(ScreenMenuCategory y)
at System.Linq.Enumerable.All[TSource](IEnumerable1 source, Func2 predicate)
at Samba.Management.MenuModule.ScreenMenuValidatior.<>c.<.ctor>b__0_4(IList1 x) at FluentValidation.DefaultValidatorExtensions.<>c__DisplayClass12.b__0(T x, TProperty val)
at FluentValidation.DefaultValidatorExtensions.<>c__DisplayClass42.<Must>b__3(T x, TProperty val, PropertyValidatorContext propertyValidatorContext) at FluentValidation.DefaultValidatorExtensions.<>c__DisplayClass72.b__6(Object instance, Object property, PropertyValidatorContext propertyValidatorContext)
at FluentValidation.Validators.PredicateValidator.IsValid(PropertyValidatorContext context)
at FluentValidation.Validators.PropertyValidator.Validate(PropertyValidatorContext context)
at FluentValidation.Internal.PropertyRule.InvokePropertyValidator(ValidationContext context, IPropertyValidator validator, String propertyName)
at FluentValidation.Internal.PropertyRule.d__8.MoveNext()
at System.Linq.Enumerable.d__172.MoveNext() at System.Collections.Generic.List1…ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at FluentValidation.AbstractValidator1.Validate(ValidationContext1 context)
at FluentValidation.AbstractValidator1.Validate(T instance) at Samba.Presentation.Common.ModelBase.EntityViewModelBase1.Validate()
at Samba.Presentation.Common.ModelBase.EntityViewModelBase1.CanSave(String arg) at Microsoft.Practices.Prism.Commands.DelegateCommand1.<>c__DisplayClass6.<.ctor>b__3(Object o)
at Microsoft.Practices.Prism.Commands.DelegateCommandBase.CanExecute(Object parameter)
at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.CanExecute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CanExecuteCommandSource(ICommandSource commandSource)
at System.Windows.Controls.Primitives.ButtonBase.UpdateCanExecute()
at System.Windows.Controls.Primitives.ButtonBase.HookCommand(ICommand command)
at System.Windows.Controls.Primitives.ButtonBase.OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.Activate(Object item)
at System.Windows.Data.BindingExpression.AttachToContext(AttachAttempt attempt)
at System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
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)

[Assembly Info]

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

[System Info]

Operating System
-Microsoft Windows 10 Home Single Language
–CodeSet = 1252
–CSDVersion =
–CurrentTimeZone = 420
–FreePhysicalMemory = 1361192
–OSArchitecture = 64-bit
–OSLanguage = 1033
–ServicePackMajorVersion = 0
–ServicePackMinorVersion = 0
–Version = 10.0.17134

–Manufacturer = HP
–Model = HP All-in-One 22-c0xx
–TotalPhysicalMemory = 4156342272

Its about your button colors i saw. Can you check it again?

It was working OK. I guess I must have changed something but I cant remember what but it definitely wasn’t colours. I have checked the colours via the terminal and it all looks OK.

What should I be looking for?

This suggests a menu button colour issue. Guessing its maybe something to do with the validation added in a recent release maybe. What version of Samba is installed?

The latest one I think, 5.2.7.

The file path C:\Users\vehbi\Source\Repos\sambapos-v5-pro\Samba.Presentation.ClientLibrary\Modules\PosModule\SubButtonColorDef.cs doesn’t exist. There is no vehbi as a user so this doesn’t make much sense

That directory doesn’t make much sense all together, perhaps the directory has been mistakenly hardcoded on update compile?

That’s just a repository link. It’s a Sub Button color set to NULL but it can’t be NULL. Run through and choose a color for all Sub Button color sections in Menu

Problem is that I can’t get into the menu to look at anything because the error prevents the screen from loading. Looking at the database in HeidiSQL shows the sub-button colours are all NULL, but that is the default setting

I have rebuilt the entire menu as a duplicate and so far seems OK. Now going through and adjusting the different settings to see if I can determine the problem in case it happens again.

Do not adjust setting in the DB. You will break something for sure. Instead try running the Maintenence Tasks in settings - program settings

Tried that. It didn’t solve the problem

That is the table schema rather than actual values?

Can you send a screenshot of colours ScreenMenu

Not mistakenly hardcoded. It’s source code’s directory. Dotnet shows it in error logging. It’s not problem. Its regular.

@VehbiEmiroglu I’m not sure what you want. There is a ScreenMenus table but it doesn’t tell us much

Or there is ScreenMenuCategories which I think is probably what you are looking for (if not, please let me know)

@JTRTech it is indeed,. It was to say the NULL values are the norm rather than a problem.

Ok i will check it again

It should work fine on next update.

1 Like

OK, thanks… So if I roll back to a previous version will that resolve the problem in the short term?

Yes it solved, after tests we will publish it

You might also like to look at the colour selector at the same time. With standard or theme colours it works fine but if we click on “more colors” it defaults to RGBA with the alpha channel set to zero meaning the colour is transparent and therefore can’t be seen. It would be better if the default was 255. Not a major issue, more of a minor inconvenience.


1 Like