The code is below:
public class XiciHttp
{
public async Task<string> Login(string apiAddress)
{
using (HttpClient client = new HttpClient())
{
return await client.GetStringAsync(apiAddress);
}
}
}
The error happens in here:
await client.GetStringAsync(apiAddress);
The error message is:
Cannot convert expression type 'void' to async method return type 'string'
The situation is:
VS2012 Update 4;
Windows Phone Project (based on WP 7.1)
This class is in a PCL project
The project has refer lots of libs using NuGet (MS Async, HttpClient, Json.Net)
The strange thing is:
When I click "Build Solution", no error happens in the Error List window.
it said:
========== Build: 1 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
My Questiohn is:
1. Why
2. How to solve it?