1

I use a specific tool to inspect my app. Once the app hits a breakpoint I can invoke my tool from the Immediate Window by calling a certain function. The tool itself is a multi-threaded Windows App and therefore spawns some tasks.

The problem that I am facing is that sometimes some tasks scheduled from the tool are never run which causes my tool to hang indefinitely. I spawn tasks with ThreadPool.QueueUserWorkItem or with Task.Run and they both cause the tool to hang and never execute these tasks. If I use Thread class instead the tool works perfectly.

Also, the tool works (with Tasks) if started normally i.e. not from the Immediate Window. Therefore the problem occurs only if I use Tasks and Immediate window.

Thus, my question is what might be the reason that some tasks are never executed? I understand that Immediate Window blocks all other threads and executes the command on the thread which hit the breakpoint, but the threads/tasks spawned from the Immediate Window thread should be still executed, right?

Both my app and the tool are in C#. I am using Visual Studio Professional 2015 Update 1.

1 Answers1

0

Immediate window, in contrast to step-by-step debugging, does only execute asingle thread at a time - the main or the current thread. It Cannot invoke new threads or tasks. Therefore your tool will stuck.

Dennis Nerush
  • 5,473
  • 5
  • 25
  • 33