I have a method that calls RestSharp client ExecuteAsync<T>
where the T
I am passing is a nested object. I get an exception that says
InvalidProgramException: Request for the resource /v1/accounts/AN_1476935163870 failed No parameterless constructor defined for this object.
The object I am passing is:
public class GetAccountResponse : IGetAccountResponse
{
public GetAccountResponseBasicInfo basicInfo { get; set; }
public GetAccountResponseBillingAndPayment billingAndPayment { get; set; }
public GetAccountResponseMetrics metrics { get; set; }
public string billToContact { get; set; }
public string soldToContact { get; set; }
public bool success { get; set; }
}
Where the objects for the properties basicInfo
, billingAndPayment
, and metrics are classes that have definitions and I have not defined a consturctor. I also have tried replacing the objects with interfaces but it still throws an exception.
Thank you
There are two possible causes of this issue:
new
constraint to typed request methods, which was fixed this week