From 0234f462360ab7cb3ecddcc96e37ba21b183d29b Mon Sep 17 00:00:00 2001 From: "gu.martinm@gmail.com" Date: Sun, 17 Aug 2014 11:14:20 +0200 Subject: [PATCH] JSONRPC4NET: using ConfigureAwait(false) as much as possible --- jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs b/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs index 40db546..201439f 100644 --- a/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs +++ b/jsonrpc4net/jsonrpc4net/JsonRpcHttpAsyncClient.cs @@ -80,7 +80,7 @@ namespace GumartinM.JsonRPC4NET jsonData = JsonConvert.SerializeObject(postData, _jsonSettings); } - POSTResult postResult = await this.PostAsync(uri, method, jsonData, CancellationToken.None); + POSTResult postResult = await this.PostAsync(uri, method, jsonData, CancellationToken.None).ConfigureAwait(false); return postResult.result; } @@ -94,7 +94,7 @@ namespace GumartinM.JsonRPC4NET /// Parameters. async public Task PostRemoteServiceAsync(string uri, string method, params object[] parameters) { - await this.PostRemoteServiceAsync(uri, method, parameters); + await this.PostRemoteServiceAsync(uri, method, parameters).ConfigureAwait(false); } /// @@ -122,7 +122,7 @@ namespace GumartinM.JsonRPC4NET using (HttpContent contentRESULT = response.Content) { //TODO: What if contentRESULT is null? :( - return await this.ReadResponseAsync(contentRESULT); + return await this.ReadResponseAsync(contentRESULT).ConfigureAwait(false); } } } @@ -147,12 +147,12 @@ namespace GumartinM.JsonRPC4NET //return this.ReadResponse(jsonBytes); // Option b) with stream - using (Stream stream = await content.ReadAsStreamAsync ()) + using (Stream stream = await content.ReadAsStreamAsync().ConfigureAwait(false)) using (StreamReader streamReader = new StreamReader(stream, encoding)) { // This line makes this method useless (IMHO it is the same as the one working with bytes) // How could I work with JSON saving memory? - string json = await streamReader.ReadToEndAsync(); + string json = await streamReader.ReadToEndAsync().ConfigureAwait(false); return this.ReadResponse(json); } -- 2.1.4