c# - WCF asynchronous call not returning data -


i have problem regarding asynchronous call of wcf web service method. refuses return requested object when called using await operator. calling synchronous counterpart works fine or using result property on task<> object returns. being called wpf app's main thread serves client. didn't play around thread apartments, left generated.
don't understand, i've created simple console test app, added same service reference , asynchronous calls work fine. i'm using visual studio 2013.

    public async task<getcomputerresponse> getcomputer(int computerid)     {         try         {             _client = new serviceclient(_endpoint);             _client.open();              getcomputerrequest request = new getcomputerrequest()             {                 computerid = computerid             };              var result = await _client.getcomputerasync(request); // debugger seems stop execution here, refuses break @ next line             /* _client.getcomputer(request) or await _client.getcomputerasync(request).result work expected */             _client.close();             return result;         }         catch (exception)         {             _client.abort();             return null;         }     } 

i'm not receiving kind of error, doesn't fetch required data.
thank in advance.

adding call configureawait , passing false continueoncapturedcontext value seems have fixed problem.
has async code being called main, ui thread resulting in deadlock. says quick research, @ least. @ moment don't have enough time learn more, unfortunately.

var result = await _client.getcomputerasync(request).configureawait(false); 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -