Home > Articles > Programming > Visual Basic

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

Debugging Tasks

Visual Studio 2015 allows you to collect information about asynchronous tasks with the Tasks window. This is not a new tool; it has been available since Visual Studio 2012, but only for the Task Parallel Library. It now provides support for the Async/Await pattern in Visual Studio 2013 and requires Windows 8 or higher. To understand how it works, place a breakpoint on the QueryVideosAsync method in the sample WPF application and press F5. When the breakpoint is hit, select Debug, Windows, Tasks and press F11 to step into the code. As you step into asynchronous method calls, the Tasks window shows information on each task, as shown in Figure 42.8.

FIGURE 42.8

FIGURE 42.8 The Tasks window.

As you can see, the Tasks window shows what task is active and what other tasks are awaiting the completion of the active task. It shows the duration, the method that started the asynchronous task (in the Location column), and the actual running task, such as a state machine (in the Task column). If you hover over the values in the ID column, you will also get additional information about the task execution order. This very useful tool helps you understand the execution flow of your asynchronous code.

  • + Share This
  • 🔖 Save To Your Account