DownloadStringTaskAsync on WP7 hangs when retrieving Result

I converted a bunch of WP7 code to use DownloadStringTaskAsync instead of DownloadStringAsync using the Async CTP SP1. It wasn't working so I boiled down my code a bunch and ended up with these 2 lines:

var wc = new WebClient();
var result = wc.DownloadStringTaskAsync("").Result;

If I run this method with a console app on my windows machine. Its works as I expect and I get a string with the contents of If I run the same 2 lines in the constructor of App in a blank WP7 app, it hangs while waiting for Result to become available.

Can anyone help me fix these lines so they will work on the phone? Or is this a bug in the CTP and I should skip it for now.


Windows Phone brings back HTTP requests on the UI thread. By accessing Result, you are blocking the UI thread, thus making it impossible for the response to come back.

Considering you are using the async CTP, why would you want to block at all?

var result = await wc.DownloadStringTaskAsync("");

Need Your Help

Declare list elements as symbols sympy python

python sympy

I've got a function that returns some list elements under some conditions :

Return records where regexp not matched but does not contain word

mysql regex

I'm trying to return MySQL records where they don't end in a specific way but I'm having trouble getting what I want (and describing it to be honest).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.