As it is mentioned here (great blog, btw), for correct work of CPU-bound calls, proper async calls are needed. For example, not
await Task.Run(() => Thread.Sleep(100));
but
await Task.Delay(100);
Is there analogue for Json.net deserializing ?
await TaskEx.Run(() => JsonConvert.DeserializeObject<PocoProduct>(resultString));
The context of usage:
async public Task<ProductsAnswer> RequestServerAsync()
{
// Just a wrapper for await httpWebRequest.GetResponseAsync() and await postStreamReader.ReadToEndAsync()
var resultString = await new NetworkManager().GetAsync(Constants.SERVER_REQUEST);
// await TaskEx.Run(() => JsonConvert.DeserializeObject<PocoProduct>(resultString));
var answer = await ParseProductsFromString(resultString);
return answer;
}