Custom Activity Hanging when calling Async API's

Hello,

I have a custom activity that calls a Web API to upload a file.
Everything works fine, the API gets executed and returns correctly.

API:

public async Task UploadDocument

  • returns an Ok() result (the OK is of type ControllerBase)

Activity:
Execute Function:

obj.doAsyncCall().GetAwaiter().GetResult();

doAsync Function:

private async Task doAsyncCall()

var response = await httpClient.SendAsync(request);
obj.statusCode = response.StatusCode.ToString();
obj.isSuccessStatusCode = response.IsSuccessStatusCode;
return “Completed”;

I am now at my wits end with this as I have tried a few other approaches to avail.

Any help?

Presumably you might be using the CodeActivity instead of AsyncCodeActivity.

You can refer here for some samples I did - https://github.com/ANUBHAV-APJ/experiments/tree/master/AsyncAndSyncActivitySamples

1 Like