I can't await awaitable?

async-await, c#

Solution

You're probably targeting .NET 4.0.

If you can, switch to .NET 4.5 which supports async/await semantics.

If you can't, consider using the Async Targeting Pack: https://www.nuget.org/packages/Microsoft.CompilerServices.AsyncTargetingPack

Edit

As per the comments, `Microsoft.Bcl.Async` should be used instead: https://www.nuget.org/packages/Microsoft.Bcl.Async

Problem

Visual Studio complains on the following: ``` public RelayCommand SendRegistrationCommand { get; private set; } public async void SendRegistration() { HttpClient client = new HttpClient(); var response = await client.GetStringAsync("url"); // ... todo } Cannot await 'System.Threading.Tasks.Task<string>' ``` I thought I've done this before, GetStringAsync is not awaitable?

Original source

Related problems