I have simple wpf application with one button and one textblock. Button click event handler run next code:
var resultTask = webClient.DownloadStringTaskAsync("http://google.com");
textBlock.Text = resultTask.Result;
And this doesn't work (it hangout) until I use await
var result = await ebClient.DownloadStringTaskAsync("http://google.com");
textBlock.Text = result;
But in simple console application it work fine.
var resultTask = webClient.DownloadStringTaskAsync("http://google.com");
Console.WriteLine(resultTask.Result);
Can you explane me why first variant doesn't work in wpf?