The following fails silently on the indicated line.
using (var ht = new HttpClient())
{
var r = await ht.GetAsync(RootUrl + Id.ToString()); <-----
Page = await r.Content.ReadAsStringAsync();
}
No exception, no error, no nothing. Execution just stops, doesn't hit a breakpoint on the next line, and the app exits. Surrounding in a try/catch doesn't trigger a catch either.
Running as a DNX .xproj commandline app.
Same behavior with both coreclr and full. Started both through VS, and DNX command line.
What the heck is going on?
Project.json is as follows:
{
"version": "1.0.0-*",
"description": "Scrapers Console Application",
"authors": [ "Kaelan" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"System.Net.Http": "4.0.0-*",
"HtmlAgilityPack": "1.4.9"
},
"commands": {
"Scrapers": "Scrapers"
},
"frameworks": {
"dnx451": { }
}
}
Edit: Full code i'm working with. Took the chunk of the actual project to test, (maintains the same issue).
public class Program
{
const string RootUrl = "<-snipped->";
public async void Main(string[] args)
{
var Id = 244;
var Page = "";
using (var ht = new HttpClient())
{
var r = await ht.GetAsync(RootUrl + Id.ToString());
Debug.Write(r.StatusCode + " on page: " + Id.ToString());
Page = await r.Content.ReadAsStringAsync();
}
Console.ReadLine();
}
}