简体   繁体   English

从MSTest Runner或Console App的Debugger下的PortableClassLibrary类消耗ConfiguredTaskAwaitable有什么问题?

[英]What's wrong with consuming ConfiguredTaskAwaitable from PortableClassLibrary's class under Debugger from MSTest Runner or Console App?

Note: This is only a Debug-time error, but a very weird one. 注意:这只是一个调试时错误,但非常奇怪。

Problem: 问题:

While running with Debugger attached and calling a method, exposed in separate Portable library, returning ConfiguredTaskAwaitable , we get InvalidProgramException . 在附带调试器的情况下运行并调用一个方法,在单独的可移植库中公开,返回ConfiguredTaskAwaitable ,我们得到InvalidProgramException

Reproduce It: 再现它:

Having 2 projects: 有2个项目:

  1. PortableClassLibrary (supporting .Net 4.5; Windows Store; Windows Phone 8) with 1 class: PortableClassLibrary(支持.Net 4.5; Windows应用商店; Windows Phone 8),带有1个类:

     public class Weird { public static ConfiguredTaskAwaitable GetConfiguredTaskAwaitable() { return new ConfiguredTaskAwaitable(); } } 
  2. ConsoleApplication with code: ConsoleApplication与代码:

     static void Main(string[] args) { Weird.GetConfiguredTaskAwaitable(); } 

Notes: 笔记:

  1. replacing ConfiguredTaskAwaitable with ConfiguredTaskAwaitable<T> (a generic version) fixes this strange issue ConfiguredTaskAwaitable ConfiguredTaskAwaitable<T> (通用版本)替换ConfiguredTaskAwaitable修复了这个奇怪的问题
  2. consuming this method form WP8 or Win8 app under Debugger works fine. 从Debugger下的WP8或Win8应用程序中使用此方法可以正常工作。

Currently it causes problems cause I cant run my Unit Tests under Debugger. 目前它导致问题导致我无法在调试器下运行我的单元测试。 I'm forced to change my "ObjectUnderTest" implementation to return generic ConfiguredTaskAwaitable<T> , which is fine for the real project, but still is only a workaround. 我被迫改变我的“ObjectUnderTest”实现以返回通用的ConfiguredTaskAwaitable<T> ,这对于真实项目来说很好,但仍然只是一种解决方法。

The Question is: 问题是:

Does anybody know the reason for this error? 有人知道这个错误的原因吗? It's definitely related to Portable Class Library magic. 它绝对与Portable Class Library魔法有关。

Are you using Visual Studio Ultimate 2012 with IntelliTrace enabled? 您是否在启用IntelliTrace的情况下使用Visual Studio Ultimate 2012? This looks like a bug which should be fixed in the latest CTP of Visual Studio 2012, Update 2 and in future releases. 这看起来像一个bug,应该在Visual Studio 2012,Update 2和未来版本的最新CTP中修复。

You can confirm this is the problem (and work around it until you get the fix) by going to Tools/Options/IntelliTrace and turning off 'Enable IntelliTrace'. 您可以通过转到Tools / Options / IntelliTrace并关闭“启用IntelliTrace”来确认这是问题(并在解决问题之前解决)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 对于 ConfiguredTaskAwaitable,与 Unwrap 等效的是什么? - What's the equivalent to Unwrap for a ConfiguredTaskAwaitable? 这个来自jquery的modelbinding,这是怎么回事? - This modelbinding from jquery, what's wrong with it? 从类列表打印有什么问题? - What's wrong with printing from the List of classes? 将一行“数据”从一个C#控制台应用程序传递到另一个C#控制台应用程序的最佳方法是什么? - What's the best way to pass a “row of data” from one C# console app to another C# console app? 在控制台应用程序中,防止转义命令行参数中特殊序列的最佳方法是什么? - in a console app what's the best way to prevent special sequences in command line arguments from being escaped? 从控制台应用程序中使用Web服务 - Consuming a Webservice from a Console Application 是什么导致在单元测试(NUnit或MSTest)中从C#调用的C ++函数产生的结果不同于在控制台应用程序中运行的同一代码? - What is causing a C++ function called from C# in a unit test (NUnit or MSTest) to produce a different result from the same code run in a console app? C#-我从double转换为int有什么问题? - C# - What's wrong with my conversion from double to int? 我的App.config有什么问题? - What's wrong with my App.config? 这种从 C# 中的多项式中采样的简单方法有什么问题? - What's wrong with this simple method to sample from multinomial in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM