Weird HttpClient behaviour in Jiwa
In a win forms application the following code works and doesn't freeze
Inside Jiwa it freezes the application but changing the code to the following doesn't freeze
It would appear Jiwa doesn't like the code executing on the main User interface thread, although I have overcome the issue what I am trying to work out is why.
- Code: Select all
HttpResponseMessage response = httpClient.SendAsync(request).Result;
Inside Jiwa it freezes the application but changing the code to the following doesn't freeze
- Code: Select all
HttpResponseMessage response = SendAsync(httpClient, request);
public HttpResponseMessage SendAsync(HttpClient client, HttpRequestMessage request)
{
HttpResponseMessage response = null;
var task = Task.Run(() => response = client.SendAsync(request).Result);
task.Wait();
return response;
}
It would appear Jiwa doesn't like the code executing on the main User interface thread, although I have overcome the issue what I am trying to work out is why.