Escape
Escape

Reputation: 51

About error in multitasking cross application

I have a Xamarin forms cross application that use a rest client to invoke a remote service.

So I use async method but when in try to build or run it an error is displayed:

Severity Code Description Project File Line Suppression State

Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?

Nome file: 'Microsoft.Threading.Tasks.dll' in Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) in Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection 1 assemblies, AssemblyDefinition assembly, Boolean topLevel) in Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection 1 assemblies, AssemblyDefinition assembly, Boolean topLevel) in Xamarin.Android.Tasks.ResolveAssemblies.Execute() TEST1.Droid

I try to add a using System.Threading.Tasks in portable project but still get the error.

How can I use async/await in portable cross application ?

Upvotes: 0

Views: 113

Answers (1)

Zroq
Zroq

Reputation: 8392

Try the following approach

1) Open your Package Manager Console, and run the following commands
2) Uninstall-Package Microsoft.Bcl.Async -Force 
3) Install-Package Microsoft.Bcl.Async -Version 1.0.166-beta -Pre

Clean your solution and then rebuild;

Upvotes: 0

Related Questions