Skip to main content
The First Step
June 5, 2019
Question

.Net framework 4.5 await authorize hangs

I am running below code from my console application and it works perfectly and I can fetch data

static async Task GetCallLogs() {
 var rc = new RestClient(RINGCENTRAL_CLIENT_ID, RINGCENTRAL_CLIENT_SECRET, RINGCENTRAL_PRODUCTION_URL); await rc.Authorize("username", "ext", "password"); 
// making api calls
}


But when I am doing the same thing from the .NET framework controller, system hangs at await

public void  UpdateRingCentral()
   {
             var t= new GetCallLogs();
             t.Wait();
   }
public async Task GetCallLogs() { 
var rc = new RestClient(RINGCENTRAL_CLIENT_ID, RINGCENTRAL_CLIENT_SECRET, RINGCENTRAL_PRODUCTION_URL); await rc.Authorize("username", "ext", "password"); 
// making api calls
}


Any advice or suggestions for fixing this issue.

4 replies

The First Step
June 5, 2019
The First Step
June 22, 2019

This is a very common feature of .net platform which arise deadlock condition during making the actual REST call and parsing it as JSON .

There are many ways you can prevent this mentioned here .

Also refer here to get your answer

Another link you should read:

https://devblogs.microsoft.com/pfxteam/await-and-ui-and-deadlocks-oh-my/

The First Step
June 23, 2019

There is fee more docs available on these type of issue here.

The First Step
June 29, 2019

There is fee more docs available on these type of issue here.