Author Topic: System.ObjectDisposedException:  (Read 883 times)

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
System.ObjectDisposedException:
« on: May 21, 2020, 07:50:14 AM »
Hello, I trying to change the IPAddress from the modbusTCPCom in execution time when I receive this exception

System.ObjectDisposedException: 'The discarded object cannot be accessed.
Name of the object "ModbusTCPDataLinkLayer'

What could be the problem?

Thanks.



Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: System.ObjectDisposedException:
« Reply #1 on: May 21, 2020, 09:07:11 AM »
It looks like changing the IP address causes the DLL to be disposed. Before changing the address, try disabling subscriptions:

ModbusTCPCom1.DisableSubscriptions=True
ModbusTCPCom1.IPAddress= "192.160.1.1"
ModbusTCPCom1.DisableSubscriptions=False

mourazo

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: System.ObjectDisposedException:
« Reply #2 on: May 22, 2020, 02:17:36 AM »
it works Archie. Thanks!