Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

TargetInvocationException with PCL which uses tasks


I have created PCL with methods which use Tasks from TPL.
For this I have added nuget package Microsoft.BCL to PCL.
Everything compiles correctly but in runtime I got the following error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

right here:
var tcs = new TaskCompletionSource<string>();

Are Tasks supported at PCL with will be called from Android/Monotouch?
If yes what components/nuget packages should I use.

ps: code is tested under Visual Studio (not Xamarin Studio)



  • GuillermoGutierrezGuillermoGutierrez ESMember ✭✭✭
    edited July 2013

    PCL and Tasks are both still in alpha channel. That said, you have working sample of PCL + Tasks + async/await + HttpClient in this post using latest versions from Alpha channel.

Sign In or Register to comment.