I am currently running 2 parallel tasks every 1 second or 3 seconds.
One to read/write heartbeat comms to say we're connected (writes to a DINT which is 4 bytes) and another one that does calculations and writes a UDT to PLC (916 bytes worth of UDT info).
In the startup of my program, it's likely to get the following error:
"System.NullReferenceException: Object reference not set to an instance of an object"
at MfgControl.AdvancedHMI.Drivers.CIP.CIPforCLX.a(CLXAddress A_0, Int64 A_1, Int32 A_2)
at MfgControl.AdvancedHMI.Drivers.CIP.CIPforCLX.a(CLXAddress A_0, UInt16 A_1, Byte[] A_2, Int32 A_3, Int64 A_4)
at MfgControl.AdvancedHMI.Drivers.EthernetIPforCLX.BeginWriteRaw(String startAddress, Int32 numberOfElements, Byte[] dataToWrite)
This only occurs when trying to BeginWriteRaw() or WriteRaw() to PLC (never a problem with connecting to PLC).
If I try/catch this in an infinite loop, it will eventually not error out and write every time, but after a while, it will miss a write here and there and be good for a while again.
Anyone know the possible cause for this or any ideas?