Connecting ADS variables, which are not located in theTwinCat PLC task

Hi all,

I am trying to connect variables between TwinCat and VC by using ADS.
When I add a server to my TwinCat PLC using port 851, everything works fine.

In my TwinCat solution, I have several different tasks, which use different ADS ports. I can establish a connection between VC and these different tasks, browse the server variables of the tasks in VC and pair them with VC variables. So far, so so good.

But when I start my simulation, I get the following error:

2021-11-05 15:54:17,403 ERROR - 0:00:01.802 Connectivity error: Beckhoff ADS - Server - Server to simulation - Unexpected error occurred in the connection plugin while trying to read from the server. Nullable object must have a value.

I have this issue only when I connect to variables, which do not belong to the PLC task, but to different tasks.
TwinCat is running and plausible values are written to the variables, no values are 0.

Maybe someome here experienced this behavior before.
Thanks in advance for your help.

Hello everyone,
We finally found a solution for that issue. For some reason the ADS connection to TwinCat was corrupted when I didn’t use the default port 851.
After crating a server node to our custom port 308, we could see that these checkboxes were missing, even if VC said that it connected succesfully. In this state, it is not possible to submit variables through the connection.
We were able fix that by creating a new server node with default port 851 and establishing a succesful connection. After that, we changed the port to our custom port 308 and connected again. Then the connection was ok.
Support VC ADS_1
Support VC ADS

Edit: In the screenshot that shows the “corrupted state” it says not connected. We were also able to connect to TwinCat in that state, but when we wanted to submit variables, VC threw the error in my orignal post.