[Solved] Why does this causes the application to hang [closed]

The biggest problem here is that your constructor does not return until all of the tasks have completed. Until the constructor returns, the window will not be shown, because the window messages related to drawing the window aren’t going to be processed. Note that you don’t really have “deadlock” here per se. Instead, if you … Read more

[Solved] Why is the C# Task Parallel Library code slower than a normal for loop?

To get more accurate results, remove the calls to Console.WriteLine inside both loops. You will still see that parallel loop is slower, because of the reasons stated in the question comments. To get a better feel for why that is, use instead an overload of Parallel.For from here and set the property ParallelOptions.MaxDegreeOfParallelism to 4 … Read more

[Solved] What’s the difference between await (async) Task and await Task? [duplicate]

Case B is not async-await. If you have a thread, and this thread has to start a fairly lengthy process in which it has nothing to do but wait, usually because someone / something else performs the operation, then your thread could decide to do something else instead of waiting for the operation to finish. … Read more

[Solved] Why is the Windows Forms UI blocked when executing Task with ContinueWith?

Since you already create (and save) your tasks, the easiest fix would be to await them for each iteration of your while loop: while (run) { action2(); foreach (Task t in continutask) await t; } That way, when all pings completed (successful or not) you start the entire process again – without delay. One more … Read more