dwmkerr / dwmkerr/consolecontrol
BackgroundWorker is busy even after IsProcessRunning is false
- Dominant language
- C#
- Stars
- 786
- Forks
- 166
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 1
Description
Hello,
So basically i'm looping over some array and for each item I want to start a new process and when it ends, carry on with the next one...
Here is the code (I'm calling this from another thread) the view.console object is ConsoleControl.WPF
```
foreach (string word in words)
{
bool isRunning = view.console.Dispatcher.Invoke(() => view.console.IsProcessRunning);
while (isRunning)
{
//Wait and query again after 250ms
//Thread.Sleep(250);
isRunning = view.console.Dispatcher.Invoke(() => view.console.IsProcessRunning);
}
view.console.Dispatcher.Invoke(new Action(view.console.StartProcess), executablePath, cliArguments + word);
}
```
The only way I could get it to work is with that Thread.Sleep() in the while loop.
Am I doing something wrong, or is this a bug?
Btw, when I run the code in step-by-step in VS it works fine.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.