I try to use Async with Portable Class Library. I use Profile 104, which includes:
- .NET 4.5
- Silverlight 4
- WP 7.5
- WinRT
Installation works and I can use System.Threading.Tasks
but I can't compile because I have this error:
Cannot await
System.Threading.Task<System.Net.HttpWebResponse>
On the line with await
in this sample:
public async Task<string> GetAsync(string urlToCall)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlToCall);
request.Method = HttpMethod.Get;
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
using (var sr = new StreamReader(response.GetResponseStream()))
{
return sr.ReadToEnd();
}
}
Why?
Update
My profile 104 is update with monodroid and monotouch I use NuGet to install Microsoft.Bcl.Async v 1.0.16 If I add AsyncBridge.Portable v 0.2.0 I have no warning of Visual Studio, but it doesn't compile. There are conflicts between this 2 libraries in System.Attributes
How make working this libraries together ?
Thanks