8

I have Visual Studio Professional 2013 and I am debugging an application which uses async/await extensively. But when I stop at breakpoint and open Debug/Windows/Tasks window, it always says "No tasks to display."

I've made two test, in one I can see task, in another I can't (I run program, and pause it). Or I can breakpoint at waiting fro task line.

using System; using System.Threading; using System.Threading.Tasks; namespace TasksDebugWindowTest { class Program { static void Main(string[] args) { DoesNotWork(); } static void Works() { Console.WriteLine("Starting"); var t = Task.Factory.StartNew(() => { Task.Delay(100 * 1000).Wait(); Console.WriteLine("Task complete"); }); Console.WriteLine("Status: {0}", t.Status); Thread.Sleep(500); Console.WriteLine("Status: {0}", t.Status); t.Wait(); Console.WriteLine("Done"); } static void DoesNotWork() { Console.WriteLine("Starting"); var t = Task.Delay(100 * 1000); t.Wait(); // **** Breakpoint here Console.WriteLine("Task complete"); } } } 

Can anybody explain why I can see tasks in one case but not in another?

10
  • It should show up, I created a simple test program and when I look at my task view it shows up (this screenshot is from VS2013 Premium). Can you add a simple test program that replicates the problem and post it in your question as a edit? Without a reproducible example your question is likely to be closed. Commented Oct 29, 2014 at 19:15
  • Thanks Scott, added the code, and manage to make it working in one case. Commented Oct 29, 2014 at 19:39
  • Can you post a screenshot of it not working? Your "does not work example" works fine on my machine if I hit pause during the wait or if I use a breakpoint Commented Oct 29, 2014 at 21:31
  • Here it is, @ScottChamberlain: drive.google.com/file/d/0B1rtAhmWT6bpN3NkSXlNY0JlVnM/… Commented Oct 29, 2014 at 22:16
  • Very very strange. I just came home from work to try it out... and my home computer does not show the task. Commented Oct 29, 2014 at 22:49

1 Answer 1

7

From http://blogs.msdn.com/b/dotnet/archive/2013/06/26/announcing-the-net-framework-4-5-1-preview.aspx

In Windows 8.1 Preview, the OS has an understanding of asynchronous operations and the states that they can be in, which is then used by Visual Studio 2013 preview, in this new window [Tasks] 

Given that @ScottChamberlain confirmed that Tasks window in Visual Studio works on Win8.1 and not on Win7, that seems to be the problem.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.