Author Topic: Exceptions in ClxDriver.dll  (Read 1224 times)

robo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Exceptions in ClxDriver.dll
« on: March 17, 2021, 08:12:06 AM »
I mistakenly posted this in tips and tricks first, I just moved it here where I think it should be...

Hi!  I've been tinkering with AHMI for a couple of years.  I recently purchased the ClxDriver.dll and control packs to help support, and also because I wanted an easy way to deploy a click-once app with some of the AHMI features.

I have noticed that when I use the EthernetIPForCLXCom.Subscribe method, even with a try-catch block, I never seem to actually hit the catch block when I get an exception (Wrong tag name in the subscription), yet the app is throwing an exception in the debugger.  The only place I can see that exception is in the debugger, the code continues to run without displaying the messagebox that I have in the catch section.

When I use just a .read("Tagname"), the exception acts as it should and I do hit the catch block.  Only the Subscription method seems to hide the exception when using the ClxDriver.dll.

I have uploaded an image showing the only way I can see the exception.  Maybe it is my VS settings, possibly, but this is the first time I have ever encountered this.

Here is the code that is causing the exception, the tag name error was in:

Code: [Select]
     Private Sub DataSubscriptionToPLC()
        Try
            PLCSubscriptionIDs.Add(PLC.Subscribe(PLCTag_InvalidateTorques, 1, AddressOf SubscriptionCallback))
            PLCSubscriptionIDs.Add(PLC.Subscribe(PLCTag_AddTorques, 1, AddressOf SubscriptionCallback))       
        Catch ex As Exception
            MsgBox("Failed to subscribe. " & ex.Message)
        End Try
    End Sub

The tag name was wrong in PLCTag_InvalidateTorques, but it never actually failed and presented any exception.

Any ideas how I can catch this exception?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Exceptions in ClxDriver.dll
« Reply #1 on: March 17, 2021, 07:20:43 PM »
Do you know which version of the driver you have?

robo

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Exceptions in ClxDriver.dll
« Reply #2 on: March 18, 2021, 06:24:45 AM »
Right clicking on the file ClxDriver.dll and selection properties shows a file version/product version of 1.3.4.0.  I just received the file it this week.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Exceptions in ClxDriver.dll
« Reply #3 on: March 20, 2021, 08:48:11 AM »
The error from subscribing to a tag that does not exist is reported in the ComError event.

Code: [Select]
Private Sub CLXDriver1_ComError(sender As Object, e As ClxDriver.Common.PlcComEventArgs) Handles CLXDriver1.ComError
    PLCComStatus.Text = Now() & "  " & e.ErrorMessage & e.PlcAddress
End Sub