Hi,
I am using PowerApps-Samples Code from https://github.com/microsoft/PowerApps-Samples/tree/master/cds but i am getting error with
Severity Code Description Project File Line Suppression State
Error CS1061 'HttpRequestMessage' does not contain a definition for 'Clone' and no accessible extension method 'Clone' accepting a first argument of type 'HttpRequestMessage' could be found (are you missing a using directive or an assembly reference?) Dynamics Webapi C:\Users\lenova\source\repos\Dynamics Webapi\Dynamics Webapi\CDSWebApiService.cs 469 Active
i am using this file path Dynamics Webapi\Dynamics Webapi\CDSWebApiService.cs
The code as below
private async Task SendAsync(
HttpRequestMessage request,
HttpCompletionOption httpCompletionOption = HttpCompletionOption.ResponseHeadersRead,
int retryCount = 0)
{
HttpResponseMessage response;
try
{
//The request is cloned so it can be sent again.
response = await httpClient.SendAsync(request.Clone(), httpCompletionOption);
}
catch (Exception)
{
throw;
}
if (!response.IsSuccessStatusCode)
{
if ((int)response.StatusCode != 429)
{
//Not a service protection limit error
throw ParseError(response);
}
else
{
// Give up re-trying if exceeding the maxRetries
if ( retryCount >= config.MaxRetries)
{
throw ParseError(response);
}
int seconds;
//Try to use the Retry-After header value if it is returned.
if (response.Headers.Contains("Retry-After"))
{
seconds = int.Parse(response.Headers.GetValues("Retry-After").FirstOrDefault());
}
else
{
//Otherwise, use an exponential backoff strategy
seconds = (int)Math.Pow(2, retryCount);
}
Thread.Sleep(TimeSpan.FromSeconds(seconds));
return await SendAsync(request, httpCompletionOption, retryCount);
}
}
else
{
return response;
}
}
Any help would be appreciated.thank you