locked
unhandled error with Zebra service object

    Question

  • I am attempting to get the Zebra service object working.
    I run into numerous problems including the following when I try to run the zebra test application.

    ZPOS.exe - Common Language Runtime Debugging Services
    ---------------------------
    Application has generated an exception that could not be handled.

    Process id=0x13d4 (5076), Thread id=0x17d4 (6100).

    Click OK to terminate the application.
    Click CANCEL to debug the application.
    ---------------------------
    OK   Cancel  
    ---------------------------

    I tried uninstalling and reinstalling but same error.



    Another question related to the Zebra SO....why does Zebra install version 1.1 of the POS for .NET assemblies into the control assemblies folder?  Is there any justification for this?

    Friday, September 11, 2009 12:49 AM

Answers

  • I believe I have figured this out.

    I installed POS for .NET 1.1 and it worked.
    It seems to be poor design on the part of Zebra.

    Is there any way to force the zebra service object to use whatever pos for.net installed, instead of relying on 1.1
    This is a major pain.

    • Marked as answer by YortEditor Thursday, September 17, 2009 5:03 AM
    Friday, September 11, 2009 1:29 AM

All replies

  • Hi,

    While I've downloaded the Zebra service objects for curitosities sake, I have no Zebra hardware and so haven't actually used them. Therefore, I can't talk to specifics, but;

    The error you're getting seems to be a generic message for several different possible causes. Can you check the windows event log to see if there is more information about the error in there ? Also, more helpful might be to tell us about the problems you get when calling it from your own code, since you can actually trap those exceptions yourself and post the details here for us to analyse. Since the Zebra app is a test one, it likely doesn't have good error handling.

    I presume (but have no evidence), that Zebra developed their service objects against Pos .Net 1.1. and therefore ship that version with their service objects... but I'm not really sure why since it should be up to the user to the application to install Pos .Net, they should just install their files to the usual folders, or check that Pos .Net is installed first and complain if it isn't rather than installing a specific version. Seems like they just did the wrong thing, probably from not knowing any better... but again that's all just a guess.
    Friday, September 11, 2009 1:09 AM
    Answerer
  • In the Zebra device manager I get this error, although it doesnt seem to be a critial error:
    Zebra OPOS Device Manager 1.0
    ---------------------------
    Object reference not set to an instance of an object.
    ---------------------------
    OK  
    ---------------------------

    I can see the service object and it shows the printer hash so I know the printer is recoginzed by POS for .NET.
    In the Microsoft Test APp, it throws this error.

    Throws error "POSControlException ErrorCode(Illegal) ExtendedErrorCode(0) occurred: The value of the 'DeviceName' property must be defined by the service object before Open() can be called.
    Created instance of device: ZPLSO"


    I dont have any actual code yet to test against.  I just get trying to get the device configured first.
    Googling that error seems to indicate it has something to do with .NET framework, but i have all of the frameworks installed.


    I checked the Event log and this is what i found:





    Event Type: Error
    Event Source: Microsoft Point Of Service
    Event Category: None
    Event ID: 0
    Date:  9/10/2009
    Time:  5:00:00 PM
    User:  N/A
    Computer: TED02
    Description:
    Microsoft.PointOfService.PosControlException: The value of the 'DeviceName' property must be defined by the service object before Open() can be called.
    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)
       at Microsoft.PointOfService.Internal.PosCommonInternal.ThrowPOSException(String Resource, String s1, ErrorCode code)
       at Microsoft.PointOfService.Internal.PosCommonInternal.Open()
       at Microsoft.PointOfService.BasicServiceObjects.PosPrinterBasic.Open()
       at Microsoft.PointOfService.BaseServiceObjects.PosPrinterBase.Open()
       at PosPrinterSO.ZebraZPLSO.Open()
       at TestApplication.MainForm.OpenDevice(TreeNode node)
       at TestApplication.MainForm.OpenDevice_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at TestApplication.MainForm.Main()

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


    Event Type: Error
    Event Source: Microsoft Point Of Service
    Event Category: None
    Event ID: 0
    Date:  9/10/2009
    Time:  4:59:00 PM
    User:  N/A
    Computer: TED02
    Description:
    Microsoft.PointOfService.PosManagementException: PosPrinter.ZPLSO: No such <Device> tag in file
    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.PosManagementException..ctor(String message)
       at Microsoft.PointOfService.Management.Explorer.ThrowManagementException(String context, String message)
       at Microsoft.PointOfService.Management.Explorer.DeleteName(Device posDevice, String name)
       at Microsoft.PointOfService.Management.Device.DeleteName(String name)
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at Microsoft.PointOfService.WMI2OMAdapter.WMI2OMAdapter.InvokeClassMethod(Object instance, XmlElement elPointer, XmlElement elTargetNode, XmlElement elCommand, Object thisValue)
       at Microsoft.PointOfService.WMI2OMAdapter.WMI2OMAdapter.Execute(String command)

    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

    Friday, September 11, 2009 1:18 AM
  • Hi,

    The object reference error is poor coding or error handling on the part of the person who wrote the app, it's likely there is an error condition but that error isn't very useful. As for the second error (no device name configured)....

    That *sounds* like a bug in the service object... either that or it isn't correctly configured, or it hasn't connected to the printer properly.

    Have you used the "Zebra OPOS Device Manager" application installed on your start menu to configure the device ? If not, I would try that first.

    If that still doesn't work, then try configuring a logical name... you shouldn't have to, and I don't think it's a logical name the device is complaining about, but it's the only other thing I can think of to suggest. The "Zebra OPOS Device Manager" lets you configure a logical name for the device, so you could try setting up the logical name that way.

    Friday, September 11, 2009 1:23 AM
    Answerer
  • I believe I have figured this out.

    I installed POS for .NET 1.1 and it worked.
    It seems to be poor design on the part of Zebra.

    Is there any way to force the zebra service object to use whatever pos for.net installed, instead of relying on 1.1
    This is a major pain.

    • Marked as answer by YortEditor Thursday, September 17, 2009 5:03 AM
    Friday, September 11, 2009 1:29 AM
  • The other error about the device name not present still persists.
    I do have a logical name set via the Zebra device manager and this appears in the service object manager with teh device.
    As I mentioned, the device hash also appears in the service object manager so POS for .NET is recognizing the device.


    Friday, September 11, 2009 1:41 AM
  • Hi,

    I marked your post as an answer as it does answer the original question about why the error occurs... I don't know if you can force the service object to use another version of Pos .Net or not, but I suspect not.
    Thursday, September 17, 2009 5:04 AM
    Answerer