0

we have a Kiosk Application and print using the Microsoft.PointOfService SDK. In our development environment everything works.

EDIT

The following specifications:

  • Windows 10 Enterprise LTSC 1809
  • .NET 4.8
  • Pos for .NET 1.14.1
  • Printer: CUSTOM VKP80III

We're trying to print a simple text, nothing fancy. Like I said the same setup worked on the development machine. Even on the machine where it's not working now it worked but suddenly stopped working. We are considering deinstalling POS and OPOS driver and than try again.

But on the customer machine (same printer/SDK/application) we get the following Error:

UPOSDevice | Method TransactionPrint threw an exception.  Service Object specific error. | Microsoft.PointOfService.PosControlException: Method TransactionPrint threw an exception.  Service Object specific error.
   at Microsoft.PointOfService.Legacy.LegacyProxy.ThrowLegacyMethodException(String methodName, Int32 ResultCode, Exception e)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object[]& parameters, Boolean[] byRef)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethodAndCheckImpl(String methodName, Object[]& parameters, Boolean[] byRef)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethodAndCheck(String methodName, Object param1, Object param2)
   at Microsoft.PointOfService.Legacy.LegacyPosPrinter.TransactionPrint(PrinterStation station, PrinterTransactionControl control)
   at UPOSPosPrinter.EndTransaction(PrinterStation station)
ErrorCode: 65535
ErrorCodeExtended: -1

The EndTransaction-Method looks like this:

public void EndTransaction(PrinterStation station)
{
    try
    {
        _device.TransactionPrint((UPOSPrinterStation)station, PrinterTransactionControl.Normal);
    }
    catch (Exception ex)
    {                
        _logger.LogError(ex, "CapTransactin: {CapTransaction} | ErrorMessage: {ErrorMessage}", _device.CapTransaction, ex.Message);     
        throw;
    }
}

I couldn't even find a defintion for the ErrorCode: 65535. Does somebody know what the problem is or at least what the ErrorCode stands for?

The log from POsforNET:

[6/13/2022 1:47:47 PM       1   ERROR   PosException]   Microsoft.PointOfService.PosControlException: Method TransactionPrint threw an exception.  Service Object specific error.
ErrorCode: Failure
ErrorCodeExtended: 0
Stack trace:    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at Microsoft.PointOfService.PosException.GetExceptionText(Exception e)
   at Microsoft.PointOfService.PosException.LogError()
   at Microsoft.PointOfService.PosControlException..ctor(String message, ErrorCode errorCode, Int32 errorCodeExtended)
   at Microsoft.PointOfService.Legacy.LegacyProxy.ThrowLegacyMethodException(String methodName, Int32 ResultCode, Exception e)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object[]& parameters, Boolean[] byRef)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethodAndCheckImpl(String methodName, Object[]& parameters, Boolean[] byRef)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethodAndCheck(String methodName, Object param1, Object param2)
   at Microsoft.PointOfService.Legacy.LegacyPosPrinter.TransactionPrint(PrinterStation station, PrinterTransactionControl control)
   at Test.Devices.UPOSPosPrinter.EndTransaction(PrinterStation station)
   at Test.Devices.IPosPrinterExtension.PrintReceipt(IPosPrinter printer, CompositeElement template, ILogger logger)
   at Test.Ticket.Controllers.PrinterController.<Print>d__6`1.MoveNext()
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Test.Ticket.Controllers.PrinterController.Print[TBonInfo](TBonInfo bonInfo, PrintLayoutType layoutType, String repeatAction, Nullable`1 layoutId)
   at Test.Ticket.Controllers.PrinterController.PrintReceipt(Nullable`1 layoutId)
   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.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Test.Core.AppCommandPipeline.<>c__DisplayClass11_1.<ResolveAppCommand>b__0(RequestContext context)
   at Test.Core.AppCommandPipeline.<<Build>b__16_0>d.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Test.Core.AppCommandPipeline.<Build>b__16_0(RequestContext context)
   at Test.Core.EventEmitterHandler.Invoke(RequestContext context)
   at Test.Core.AppCommandPipelineMiddleware.<>c__DisplayClass3_1`1.<Add>b__1(RequestContext context)
   at Test.Ticket.Middleware.ExceptionsHandler.<Invoke>d__3.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Test.Ticket.Middleware.ExceptionsHandler.Invoke(RequestContext context)
   at Test.Core.AppCommandPipelineMiddleware.<>c__DisplayClass3_1`1.<Add>b__1(RequestContext context)
   at Test.Ticket.Middleware.AvailabilityUpdateHandler.Invoke(RequestContext context)
   at Test.Core.AppCommandPipelineMiddleware.<>c__DisplayClass3_1`1.<Add>b__1(RequestContext context)
   at Test.Ticket.Middleware.PermissionHandler.Invoke(RequestContext context)
   at Test.Core.AppCommandPipelineMiddleware.<>c__DisplayClass3_1`1.<Add>b__1(RequestContext context)
   at Test.Ticket.Middleware.AuthorizationHandler.Invoke(RequestContext context)
   at Test.Core.AppCommandPipelineMiddleware.<>c__DisplayClass3_1`1.<Add>b__1(RequestContext context)
   at Test.Ticket.Middleware.TimeOutHandler.Invoke(RequestContext context)
   at Test.Core.AppCommandPipelineMiddleware.<>c__DisplayClass3_1`1.<Add>b__1(RequestContext context)
   at Test.Core.AppCommandPipeline.ExecuteRequestContext[T](RequestContext requestContext, T& executionResult)
   at Test.Core.AppCommandPipeline.Execute[T](AppCommand appCommand, T& executionResult, Object parameters)
   at CallSite.Target(Closure , CallSite , AppCommandPipeline , AppCommand , Object& , Object )
   at Test.Core.AppCommandPipeline.Execute(AppCommand appCommand, Object parameters)
   at Test.Core.AppCommandPipeline.Execute(String appCommandString, Object parameters)
   at Test.Core.AppEngine.ExecuteCommand(String appCommand)
   at Test.Core.BaseController.<Execute>d__17.MoveNext()
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Test.Core.BaseController.Execute(String appCommand)
   at Test.Ticket.Controllers.PaymentController.<Pay>d__11.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.InvokeMoveNext(Object stateMachine)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run()
   at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation.<>c.<.cctor>b__8_0(Object state)
   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)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()
   at Test.Ticket.Desktop.App.Main()
BluePalmTree
  • 299
  • 3
  • 23
  • The following may be helpful: According to [PosControlException.ErrorCodeExtended](https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms861780(v=winembedded.11)), _When the ErrorCode property contains the value Extended, this value holds the device-specific extended error code. Extended error codes are device-specific, and should be documented in the device throwing the exception._ – Tu deschizi eu inchid Jun 13 '22 at 14:27
  • You've not stated what OS you're using or what version of .NET Framework. You also haven't mentioned what type of data you're trying to print or the make/model of the printer. [PosPrinter.TransactionPrint](https://learn.microsoft.com/en-us/previous-versions/windows/embedded/ms843089(v=winembedded.11)), states: _Before it calls this method, the application must open, claim, and enable the device. TransactionPrint may throw a PosControlException with the following ErrorCodes..._. It's also unclear whether your development/testing environment used all of the exact same hardware/software. – Tu deschizi eu inchid Jun 13 '22 at 14:40

2 Answers2

0

The specification ErrorCode is a value in the range 0 or 101-115.

If the other value(65535) is notified, it is considered that the vendor who created the service object has defined some unique error and notified it.
ErrorCode Enumeration (POS for .NET v1.12 SDK Documentation)

Similarly, the value of ErrorCodeExtended will be vendor own definition.

Please refer to the include file on one of these sites for values.
CommonControlOnjects Current Version
kunif/OPOS-CCO


Please add the vendor and device model that creates the device and service object, as noted in the comments.

If anyone is using the same model from the same vendor, you may be able to share information.

However, you probably need to contact the vendor's support desk for more information.


According to the added vendor and model information:

The vendor page states that OPOS, OPOS.NET, and JavaPOS Driver are supported, but the list of downloads only had JavaPOS.
VKP80III

kunif
  • 4,060
  • 2
  • 10
  • 30
0

The problem was that we called
_device.TransactionPrint((UPOSPrinterStation)station, PrinterTransactionControl.Normal);
twice in a row. So we implemented a bool property to check if the printer is in "TransactionMode" or not and only call the TransactionPrint if this is true.


The actual problem why the printer didn't print was that the printer-driver didn't work. We had to reinstall the printer-driver. We assume a windows update was the culprit.
Another strange thing is that in other tests the same mechanism (calling the method twice) didn't produce an error. Very strange...

BluePalmTree
  • 299
  • 3
  • 23