After upgrading to v107 I'm getting this error on the Azure Pipeline:
##[error]XXXXXXXXXXX.Shared.Integration\APIClients\XXXXXXXXXXRESTClientBase.cs(114,43): Error CS1545: Property, indexer, or event 'RestResponseBase.StatusCode' is not supported by the language; try directly calling accessor methods 'RestResponseBase.get_StatusCode()' or 'RestResponseBase.set_StatusCode(??)'
The code compiles on my laptop, but for some reason it fails on the pipeline.
Could it be related to this message in the upgrade guide? "The most important change is that RestSharp stop using the legacy HttpWebRequest class, and uses well-known 'HttpClient' instead. This move solves lots of issues, like hanging connections due to improper HttpClient instance cache, updated protocols support, and many other problems."
I'm using .NET core 3.1 which still has LTS.
An example of where compilation fails is in this example:
private bool RequestFailed(HttpStatusCode statusCode)
{
var result = statusCode == HttpStatusCode.InternalServerError ||
statusCode == HttpStatusCode.ServiceUnavailable ||
statusCode == HttpStatusCode.Unauthorized;
if (result) Logger.Verbose("API Call resulted in status code: " + statusCode.ToString());
return result;
}
private bool HandleResult(RestResponse response)
{
return RequestFailed(response.StatusCode);
}
Which errors on the line:
return RequestFailed(response.StatusCode);
Similar issue:
error CS1545: Property, indexer, or event 'Parameter.Name' is not supported by the language
public static void SetCorrelationId(RestRequest request, Guid? correlationId)
{
var existingHeader = request.Parameters.Where(x => x.Name == CorrelationIdHeaderKey).FirstOrDefault();
...
}