var factory1 = new TaskFactory();
var task1 = factory1.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null).Result;
The above code work on windows 8 and windows store but when I try to run it in windows phone 8, it doesn’t work. It just freeze and doesn’t response anything, look like it take forever to run the task.
My purpose is to call web service synchronous, without using asycn and await method.
You’re not supposed to do that. WP8/Win8 are supposed to be asynchronous.
asyncandawaitmake asynchronous programming easy.I have a blog post that explains the
Resultdeadlock situation in detail (though I’m a bit surprised it happens in this scenario). In short, theasyncmethod is attempting to resume on the UI thread but the UI thread is blocked waiting for theasyncmethod to complete.Why do you want it synchronous?