问题描述
我有Visual Studio专业2013年和我调试它采用异步/广泛等待的应用程序。但是,当我停在断点调试开/窗/任务窗口,它总是说没有任务来显示。
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?
推荐答案
从的
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]
鉴于@ScottChamberlain确认在Visual Studio任务窗口适用于Win8.1而不是Win7的,这似乎是问题
Given that @ScottChamberlain confirmed that Tasks window in Visual Studio works on Win8.1 and not on Win7, that seems to be the problem.
这篇关于VS2013调试/窗/任务:[否任务显示"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!