2

I have a client/server multithreaded application and one thread is used to send a regular ping to the server. The problem appears when i want to debug other threads it also blocks my ping thread. I already tryed options in Visual Studio Debug->Windows->Thread but don't want to use it each time i need to debug a part of my application.

Moreover as I work in a team I can't force my teammates to use this technique. How can I do this without much effort for them (macro, ...)?

Thanks

edit: It's not a duplicate thread! I don't want to use conditional break point every time i need to debug my application! And don't want to complexity the debug procedure for the rest of my team. I searched everywhere and nobody spoke about executing the thread in another Process

Ludovic Feltz
  • 11,416
  • 4
  • 47
  • 63
  • Thanks for your help and sorry for the bad grammar i'm french ^^, but no i don't want to set a conditional break point each time i need to debug, same for the rest of my team – Ludovic Feltz Mar 17 '14 at 14:57
  • Workaround: assuming *ping* thread is mostly stand-alone thing, convert it to a full child process. – hyde Mar 17 '14 at 21:23
  • Thank you very much for your answers, i tryed the @hyde workaround but still have a problem, i can't access the NetworkStream of my main application from my child process but i need it to send some data. This stream is used in one side to send data and on the other to ping the server. Any idea? I will still searching... – Ludovic Feltz Mar 18 '14 at 10:40
  • Please, do not include information about a language used in a question title unless it wouldn't make sense without it. Tags serve this purpose. – Ondrej Janacek Mar 18 '14 at 12:00

1 Answers1

1

Thanks everyone i finally found an answer to my question!

As @hyde suggested i run my Ping loop in another process, but rather than create another program i dynamically create and execute it from my code

as seen in this topic: Is it possible to dynamically compile and execute C# code fragments?

And this more advanced topic: http://simeonpilgrim.com/blog/2007/12/04/compiling-and-running-code-at-runtime/

But after all i still had a problem... I needed to share my NetworkStream between my Main Application and his Child (needed to send to the same server Thread), so i gave to the child the NetworkStream by reflection.

Now work correctly, thanks!

Ludovic Feltz
  • 11,416
  • 4
  • 47
  • 63