This project is read-only.

Form hangs during execution

Apr 23, 2015 at 9:02 PM
Hi everyone!

I have noticed that my C# Form hangs while the API is executed (Connection to a wrong IP or during a XboxFile.Copy, etc...)

Before.. using Process.. I was able to:
                while (!myProcess.HasExited)
to prevent the Forms from Hang...

Do you have any workaround please that would help avoiding the hang by any chance?

Thanks a lot for your help it is really appreciated :)

Apr 23, 2015 at 9:35 PM
It sounds like you need to re-design your application to run blocking calls like XboxFile.Copy asynchronously. Your user interface thread will then be able to continue interacting with the user (and display visual indicators of being busy like hourglass or progress bar).

The recommended way of introducing asynchronous logic into a new application is the Task-based Asynchronous Pattern (TAP).

See the general page for asynchronous programming here:

See the page explaining TAP here:

The last link also has code examples when you navigate further in the topic. Here they are for convenience:
Marked as answer by Perfo_Team_MTL on 4/24/2015 at 7:11 AM
Apr 24, 2015 at 3:12 PM
Awesome! Thanks a lot for your help!! It works very well with async "await Task.Run()" :)