Xero-NetStandard: Method not found: 'RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String)'.

SDK you’re using (please complete the following information):

  • Version 3.33.0

Describe the bug When calling code; result = Await apiInstance.GetInvoicesAsync(xeroToken.AccessToken, xeroTenantId,, where) getting error ‘Method not found: ‘RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String)’.’.

To Reproduce Use this code to get the error; result = Await apiInstance.GetInvoicesAsync(xeroToken.AccessToken, xeroTenantId,, where)

Expected behavior No error.

Additional context This started happening recently on code running fine for months.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 1
  • Comments: 16

Most upvoted comments

Your only option is to fork the library, update the RestSharp dependancies and compile the binary. I created a fork myself and did this myself and it’s been working well for me while waiting for Xero to update https://github.com/amyskippy/Xero-NetStandard

I’m a little disappointed that it’s been over 3 months and it’s still an outstanding issue. I’m going to the Xero convention next year, so I might try and raise this with someone as it’s not really acceptable

But what should we do if other libs depend on the new RestSharp, i means if we are forced to update the Restsharp to the lasts one ?

I’ve encountered the same problem today while upgrade RestSharp to the latest version in our project. I’ve taken a fork of the Xero-NetStandard code and updated it to the latest RestSharp (and Newtonsoft.Json) versions and I will be testing it and pushing it to our production environment all being well.

There’s already a PR from @AshleyMedway (#478) that resolves this issue as far as I can tell.