From: Gustavo Martin Date: Tue, 27 May 2014 05:39:29 +0000 (+0200) Subject: JsonRPC4NET: weird behaviour under WindowsPhone8 X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=cc4e81423aaec148b97ab0df553fef39cd3bc7f5;p=CSharpForFun%2F.git JsonRPC4NET: weird behaviour under WindowsPhone8 await HttpClient.PostAsync returns results in the main thread, it seems as if it is not spawning new thread --- diff --git a/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs b/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs index fc93ee3..aeee6fa 100644 --- a/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs +++ b/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs @@ -112,6 +112,8 @@ namespace GumartinM.JsonRPC4NET // For HttpResponseMessage response I am sure I have to do it but I am not for HttpContent content. using (HttpClient client = new HttpClient { Timeout = TimeSpan.FromSeconds(5) }) using (HttpContent contentPOST = new StringContent(jsonData, System.Text.Encoding.UTF8, "application/json-rpc")) + // TODO: in WindowsPhone 8 client.PostAsync does not seem to spawn new thread :/ WTF + // Using WindowsPhone 8 the result is returned in the same thread!!!!! WTF using (HttpResponseMessage response = await client.PostAsync(uri, contentPOST, cancellation)) //TODO: What if response is null? :( using (HttpContent contentRESULT = response.Content)