Urgent - JScript scripts will not run

@emre

Got an urgent issue, I am installing on a client’s system and none of my scripts will work. I did a test function just returning a value to double check, the same error is returned for all scripts:

If a script is run outside the script editor, it will crash SambaPOS.

SambaPOS is v5.1.61 using SQL Express 2008 on Windows Server Standard 2008

I am wondering if it is an OS issue, is there any settings I need to configure on Windows Server that might be blocking JScript?

Unfortunately I never experienced something like that with JScript before .Maybe you can try upgrading .net framework.

Do you think that error is related to JScript or anything else I can look into that may be disabled / blocked on the server?

I lost my connection their internet went down… good timing! :stuck_out_tongue:

I checked .net before I am sure they had 3.5, 4 and 4.5 installed

I notice Windows PowerShell isn’t installed - do you think it’s related to that?

If I test if I can run a JScript script using Windows Scripting Host would that be using similar prerequisites to what SambaPOS uses?

It may give an idea.

That error message coming from a “NotImplementedException” however it is really hard to guess where it is coming from. SambaPOS uses ClearScript library to execute JScript. There might be a missing requirement for ClearScript or might be something related with OS. Maybe this is a SambaPOS bug. I even don’t know if V5 working on Windows Server 2008 Standard for somewhere else.

Created a test.js file:

WScript.Echo("test");

Works fine using both cscript and wscript. So JScript works in Windows.

Current .net framework installed

The client is going to just get their IT guy to do all the windows updates because it appears this server has never been updated… scary thought! I’ll let them deal with that first before we investigate further.

1 Like

BTW this was the original error thrown by SambaPOS if the script is not run from the script editor:

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

Application: SambaPOS
Version:     5.1.61
Region:      en
DB:          SQ
Machine:     SERVER
User:        Administrator
Date:        3/11/2017
Time:        3:13 PM

User Explanation:

Administrator said ""
-----------------------------

[Exception Info 1]

Top-level Exception
Type:        System.NotImplementedException
Message:     The method or operation is not implemented.
Source:      ClearScript
Stack Trace: at Microsoft.ClearScript.Windows.IActiveScriptProperty.SetProperty(ScriptProp property, IntPtr pVarIndex, Object& value)
   at Microsoft.ClearScript.Windows.ActiveScriptWrapper32..ctor(String progID, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.ActiveScriptWrapper.Create(String progID, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.WindowsScriptEngine.<>c__DisplayClass15_0.<.ctor>b__0()
   at Microsoft.ClearScript.ScriptEngine.ScriptInvoke[T](Func`1 func)
   at Microsoft.ClearScript.Windows.WindowsScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.JScriptEngine..ctor(String progID, String name, WindowsScriptEngineFlags flags)
   at Microsoft.ClearScript.Windows.JScriptEngine..ctor(String name, WindowsScriptEngineFlags flags)
   at Samba.Services.Implementations.ExpressionModule.ExpressionEngine.GetEngine() in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\ExpressionModule\ExpressionEngine.cs:line 31
   at Samba.Services.Implementations.ExpressionModule.ExpressionEngine.Invoke(String expression, String function, Object dataObject, Object[] args) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\ExpressionModule\ExpressionEngine.cs:line 173
   at Samba.Services.Implementations.ExpressionModule.ExpressionService.InvokeScript(String handlerFunction, Object dataObject) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\ExpressionModule\ExpressionService.cs:line 52
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Samba.Modules.AutomationModule.ActionProcessors.ExecuteScript.Process(ActionData actionData, RuleExecutionContext context)
   at Samba.Services.Common.RuleActionTypeRegistry.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Common\RuleActionTypeRegistry.cs:line 39
   at Samba.Services.Implementations.AutomationModule.AutomationService.ProcessAction(String actionType, ActionData actionData, RuleExecutionContext context) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\AutomationService.cs:line 42
   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWithoutLogging(Object dataParameter) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 110
   at Samba.Services.Implementations.AutomationModule.RuleExecutor.ExecuteWith(Object dataParameter) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\RuleExecutor.cs:line 62
   at Samba.Services.Implementations.AutomationModule.NotificationService.NotifyEvent(String eventName, Object dataParameter, AppState appState) in C:\Users\Emre\Documents\GitHub\SambaPOSPro\Samba.Services\Implementations\AutomationModule\NotificationService.cs:line 24
   at Samba.Presentation.Services.Implementations.AutomationModule.NotificationClient.NotifyEvent(String eventName, Object dataObject)
   at Samba.Modules.AutomationModule.WidgetCreators.AutomationButtonWidgetViewModel.OnItemClicked(AutomationButtonWidgetViewModel obj)
   at Microsoft.Practices.Prism.Commands.DelegateCommand`1.<>c__DisplayClass6.<.ctor>b__2(Object o)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.Execute(Object parameter)
   at Microsoft.Practices.Prism.Commands.DelegateCommandBase.System.Windows.Input.ICommand.Execute(Object parameter)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

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

[Assembly Info]

mscorlib, 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
DevExpress.Xpf.LayoutControl.v14.1, Version=14.1.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v14.1, Version=14.1.13.0
System, Version=4.0.0.0
DevExpress.Xpf.Grid.v14.1.Core, Version=14.1.13.0
WindowsBase, Version=4.0.0.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.v14.1, Version=14.1.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
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0

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

[System Info]

Operating System
-Microsoft® Windows Server® 2008 Standard
--CodeSet = 1252
--CSDVersion = Service Pack 1
--CurrentTimeZone = 180
--FreePhysicalMemory = 2365752
--OSArchitecture = 32-bit
--OSLanguage = 1033
--ServicePackMajorVersion = 1
--ServicePackMinorVersion = 0
--Version = 6.0.6001

Machine
-SERVER
--Manufacturer = HP
--Model = ProLiant ML110 G6
--TotalPhysicalMemory = 4294012928
--UserName = SERVER\Administrator

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


Hmm that probably fails because an old version of JScript is installed on the system. I enabled it to use newer version to be able to use JSON class.

However I don’t know how you can upgrade it. Installing a better IE version may help.

2 Likes