-1

I have some difficulty debugging a multithread app. So I set up a breakpoint in a worker thread and application hits it, but when I try to resume it just doesn't continue execution. It should end worker thread and then comeback to main form, but worker thread popup (it spawns a small form) just stays there forever. In addition, when I tried to break execution after that "continue" Visual Studio stops at Application.Run(...). My goal is to debug few lines in worker and see effects in main form. Anyone experienced that issue? Or maybe it is not an issue at all?

  • Show don't tell, if you are having a problem with your code, post your code in the question. – Scott Chamberlain Oct 21 '15 at 22:11
  • take a look at http://stackoverflow.com/questions/3901736/visual-studio-debug-one-of-multiple-threads may help – M.kazem Akhgary Oct 21 '15 at 22:13
  • Unfortunately, I can't and I don't think it is problem with code. I probably don't understand whole idea of debugging multithread application and this is the problem, but MSDN page says that hitting "Continue" should resume all threads, so that spawned some suspicions in my mind. – user3746935 Oct 21 '15 at 22:15

1 Answers1

0

Spawning UI on worker threads is not a good idea. If your thread is not a primary UI thread, then do not create or update UI Elements on it.

If you are in WPF, you would need to use something like Application.Current.Dispatcher.Invoketo create or update UI on the proper thread.

bigtlb
  • 1,512
  • 10
  • 16
  • No, it is Windows Forms application. – user3746935 Oct 22 '15 at 04:26
  • After all, it is not true, I'm sorry, I was mistaken, worker just sends information to main window to update UI, so your answer is completely unrelated. Anyway I just found that if I go from breakpoint to breakpoint without using step over or step into everything works just fine, which is pretty surprising to me. Sometimes I feel like this whole reputation points thing just destroy SO - people just send answers without making effort to understand the problem. – user3746935 Oct 22 '15 at 21:48