I know this is not the right way to write code, but I still like to understand this behavior - whenever I execute an async HTTP request without waiting for the result, does it look like the request is complete? (I do not see this on the violinist).
Code example:
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost.fiddlerhttpclient/");
var response = client.GetAsync("zzzz");
}
}
}
}
If I changed the code to:
var response = client.GetAsync("zzzz").Result;
I see it on the violinist. I don’t understand why - I would expect the request to continue processing in the background anyway, so why is it not?
source
share