Hello,
I'm guessing that, in your C# code, the TCP function "blocks" the Execute method and so the Task Watchdog timer is triggered.
You can check this by looking at the contents of the ~/logs/Output.log file on the PLC after it stops. There should be a message describing what caused the PLC to stop.
There is currently no up-to-date example I can share, but there has now been a feature request raised on the CSharpExamples GitHub repository on the issue of blocking calls. Please follow this issue and/or perhaps raise your own Feature Request (for a TCP Server example) on this GitHub repository.
Hope this helps.
- Martin
Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support