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
.
Having 2 projects:
PortableClassLibrary (supporting .Net 4.5; Windows Store; Windows Phone 8) with 1 class:
public class Weird
{
public static ConfiguredTaskAwaitable GetConfiguredTaskAwaitable()
{
return new ConfiguredTaskAwaitable();
}
}
ConsoleApplication with code:
static void Main(string[] args)
{
Weird.GetConfiguredTaskAwaitable();
}
ConfiguredTaskAwaitable
with ConfiguredTaskAwaitable<T>
(a generic version) fixes this strange issueCurrently 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.
Does anybody know the reason for this error? It's definitely related to Portable Class Library magic.
Are you using Visual Studio Ultimate 2012 with IntelliTrace enabled? This looks like a bug which should be fixed in the latest CTP of Visual Studio 2012, Update 2 and in future releases.
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'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With