c# - 为什么 VS 2013 Express 不允许检查 AggregateException?

标签 c# visual-studio-2013 async-await task-parallel-library

我有一个简单的 TPL+async/await 程序,我想调试它:

class Program
{
    static void Main(string[] args)
    {
        int x = ThrowException().Result;
    }

    async static Task<int> ThrowException()
    {
        throw new Exception("I want this Exception to be shown when the debugger breaks");
    }
}

我想要的行为是调试器在观察到异常时中断,并且我希望通过检查 AggregateException 的 InnerException 来访问消息(“我想要这个异常...”)。在 Visual Studio 2013 Premium 中,我得到了我想要的行为:

enter image description here

但是,Visual Studio Express 2013 for Windows Desktop 的行为就像某些不可调试的组件产生了异常,我无法获得有关它的更多信息(例如,InnerException 以及有关出错原因的实际信息):

enter image description here

这是 VS 2013 Express 的固有限制,还是我可以更改某些设置以获得 Express 中的正确行为?这两个项目的目标框架都是 4.5。

最佳答案

正如 @Hans Passant 和 @Jeff Mercado 在该问题的评论中所回答的那样,Visual Studio Express 2013 没有“异常助手”,该功能存在于 Premium 2013 以及 Visual C# 2010 Express(以及其他的)。因此,所有异常(不仅仅是涉及 TPL+async/await 功能的异常)都显示在一个无信息、丑陋的模态框中,该框不提供对异常属性的访问。

更多信息:https://connect.microsoft.com/VisualStudio/feedback/details/806898/the-exception-assistant-is-missing-again-in-2013

如果这对您来说是一个重要功能,您可以在这里投票修复它:http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/5403561-improve-usability-of-the-exception-dialog-in-expre

关于c# - 为什么 VS 2013 Express 不允许检查 AggregateException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34234093/

相关文章:

rust - 有没有办法在 Rust 的异步函数中获取对当前任务上下文的引用?

c# - 如何在 lambda 中选择期间等待

c# - Newtonsoft JSON.NET 解析为自定义键/值对对象数组

c# - 奇怪的除法行为

git - 使用 Git 时在 Visual Studio 2013 中设置 Beyond Compare

JavaScript - 同步等待异步操作(休眠)

c# - 可以将条件编译符号添加到 csproj.user 文件吗?

c# - 有什么方法可以在 C#/Visual Studio 中的断点处休眠?

visual-studio - 测试 500 个登录用户,其中 50 个用户实际在做某事

visual-studio-2013 - 安装 resharper 后 ctrl + enter 不起作用