I am integrating MailChimp API using ASYNC and JSON
****1 - Caller Section****
internal class MCReportsOverview
{
internal async Task<ReportOverview_CampaignSpecific> CampaignSpecificOverviewAsync(string campaignId)
{
string endpoint = Authenticate.EndPoint(TargetTypes.reports, SubTargetType.not_applicable, SubTargetType.not_applicable, campaignId);
var jsonTask= await BaseOperation.GetAsync<ReportOverview_CampaignSpecific>(endpoint);
return jsonTask;
}
}
**** 2 - Called Section ****
F11 hangs on the last line and doesn't return value to #1. The data is all correct. The code for the called function is
public static async Task<T> GetAsync<T>(string endpoint) where T : class
{
string content;
using (HttpClient client = new HttpClient())
{
try
{
Authenticate.ClientAuthentication(client);
content = await client.GetStringAsync(endpoint).ConfigureAwait(false);
}
}
return JsonConvert.DeserializeObject<T>(content); // F11 hangs here and doesnt return to the calling function
}
Function Calling
This is how I am calling #1
MCCampaignsOverview overview = new MCCampaignsOverview();
var yy = overview.GetCampaignByIdAsync("aaaa1111").Result;