Author Topic: InvalidComObjectException - OpcDaCom  (Read 1408 times)

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
InvalidComObjectException - OpcDaCom
« on: June 09, 2015, 02:03:42 AM »
Dear Archie,

I am using V398m, and OpcDACom communication protocol.
I got this InvalidComObjectException error 'sometimes', right after I execute Application.Exit()
It's actually not a major problem as in this case User wants to exit anyway.
But, it would be better if it's not happening at all.

Code: [Select]
Try
   Application.Exit()
Catch ex As Exception

End Try

Please advise if you have explanation or trick to prevent this error.
Thank you.

Best regards,
Andrew

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: InvalidComObjectException - OpcDaCom
« Reply #1 on: June 09, 2015, 06:38:24 AM »
That is something down in the OPC Server wrapper, so I don't have any way of knowing exactly what it is. I would modify the code like this to ignore the exception:

           If DLL.IsConnected Then
                Try
                    DLL.Disconnect()
                Catch
                End Try
            End If

andrew_pj

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
Re: InvalidComObjectException - OpcDaCom
« Reply #2 on: June 10, 2015, 12:08:36 AM »
So far no more error, Thanks.