VS2013 调试/Windows/任务:“没有要显示的任务" [英] VS2013 Debug/Windows/Tasks: "No tasks to display"

查看:20
本文介绍了VS2013 调试/Windows/任务:“没有要显示的任务"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Visual Studio Professional 2013,我正在调试一个广泛使用 async/await 的应用程序.但是当我停在断点处并打开调试/Windows/任务窗口时,它总是说没有要显示的任务."

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?

推荐答案

来自 http://blogs.msdn.com/b/dotnet/archive/2013/06/26/annoucing-the-net-framework-4-5-1-预览.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]

鉴于@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 调试/Windows/任务:“没有要显示的任务"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆