[英]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. 注意:这只是一个调试时错误,但非常奇怪。
While running with Debugger attached and calling a method, exposed in separate Portable library, returning ConfiguredTaskAwaitable
, we get InvalidProgramException
. 在附带调试器的情况下运行并调用一个方法,在单独的可移植库中公开,返回
ConfiguredTaskAwaitable
,我们得到InvalidProgramException
。
Having 2 projects: 有2个项目:
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(); } }
ConsoleApplication with code: ConsoleApplication与代码:
static void Main(string[] args) { Weird.GetConfiguredTaskAwaitable(); }
ConfiguredTaskAwaitable
with ConfiguredTaskAwaitable<T>
(a generic version) fixes this strange issue ConfiguredTaskAwaitable
ConfiguredTaskAwaitable<T>
(通用版本)替换ConfiguredTaskAwaitable
修复了这个奇怪的问题 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>
,这对于真实项目来说很好,但仍然只是一种解决方法。
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.