Why is this code not working? I've used similar things earlier which makes it even more confusing. It just exits on "await httpClient.GetAsync..." line without any exception that can be caught in try/catch. I have this same exact code in a sample console app targeting .net 4.5 and testing on two different machines, getting same result (or lack thereof).
EDIT: entire Program.cs sample
using System;
using System.Net.Http;
namespace Main
{
class Program
{
static void Main(string[] args)
{
DownloadPageAsync();
}
private static async void DownloadPageAsync()
{
var httpClient = new HttpClient();
var response = await httpClient.GetAsync("http://en.wikipedia.org/");
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
httpClient.Dispose();
Console.ReadLine();
}
}
}