Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method not found: 'RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String)'. #484

Closed
Yahya0007 opened this issue Aug 15, 2023 · 18 comments

Comments

@Yahya0007
Copy link

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.

@github-actions
Copy link

PETOSS-336

@github-actions
Copy link

Thanks for raising an issue, a ticket has been created to track your request

@Yahya0007
Copy link
Author

An update.

We are making api call GetContactByContactNumberAsync.

When we use RestSharp 108.0.1.0 we get error “Could not load file or assembly 'RestSharp, Version=110.1.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75' or one of its dependencies. The system cannot find the file specified.”

When we use RestSharp 110.1.0.0 we get error “Method not found: 'RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String)'”.

Can you recommend a RestSharp version for Xero?

@Yahya0007
Copy link
Author

Please see location of error in attached image. It seems to be within Xero SDK.

Is this something you guys would be able to look at? Thanks.

Xero-AddFile Error

@Yahya0007
Copy link
Author

I have attached a screenshot pinpointing the procedure causing the error inside Xero SDK. Any help would be appreciated. Some helpful comments from your dev team would be nice.

We are desperate.

Xero-Error-IB

@amyskippy
Copy link

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.

@nelsonkmc
Copy link

Encountered this problem today. Is there a way to resolve this?

@amyskippy
Copy link

Encountered this problem today. Is there a way to resolve this?

There's only a work around at the moment, which is to download the repo, update the nuget package references for RestSharp yourself, and then compile into either a local nuget package, or just the dlls and use those instead of the live Xero Nuget pacakages.

@Tankzor
Copy link

Tankzor commented Dec 7, 2023

Please fix this :)

@developervisualapprovals

This is critical. I am currently utilizing the BoldSign SDK, Google, and other 3rd-party SDKs in my Windows Form application. All these SDKs require the latest RestSharp (version 110.2.0.0). However, the Xero SDK is not compatible with this version, resulting in issues with SearchInvoice APIs and other accounting APIs. The error message returned is:
(Method not found: 'RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String))
I understand the reasons behind this issue and can provide further details if needed. Kindly update the Xero SDK to ensure compatibility with the latest RestSharp.

Thanks.

@ThomasLoSG
Copy link

I got the same problem too. Please fix it.

@ThomasLoSG
Copy link

Downgraded the RestSharp to 106.15.0 seems solved the problem

@developervisualapprovals

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 ?

@Tankzor
Copy link

Tankzor commented Dec 13, 2023

Yeah.. nah. I presume they're using swaggergen which has old dependencies..

@amyskippy
Copy link

amyskippy commented Dec 13, 2023

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

@slykiwi
Copy link

slykiwi commented Dec 21, 2023

I have the same problem. Can't believe Xero havn't sorted this yet.

@developervisualapprovals
Copy link

@antonzherdev
Copy link
Contributor

The issue has been resolved in the latest version of the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants