Search code examples
c#multithreadingvisual-studiodebuggingtcpsocket

Confirmation: can I debug an application while keeping a TCP socket open?


This question is just a confirmation question:

I'm working on a multi-threaded C# application, based on TCP sockets.
The connection looks unstable: it happens regularly that the connection falls after a while. I'm currently doing quite some tests, using breakpoints and single-stepping, using Visual Studio. I would like to be sure that the unstable connection is not simply caused by the fact that I'm debugging my application, hence this confirmation question:

Can hitting a breakpoint and doing some single-stepping cause a TCP socket connection to fail?


Solution

  • You can use something like Tracepoints to print dynamically information based on expressions/conditions. These won't block the currently executing thread so should work for something like this.