XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
118 stars 119 forks source link

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

Closed Yahya0007 closed 6 months ago

Yahya0007 commented 10 months ago

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

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[bot] commented 10 months ago

PETOSS-336

github-actions[bot] commented 10 months ago

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

Yahya0007 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 9 months ago

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 commented 9 months ago

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

amyskippy commented 9 months ago

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 commented 7 months ago

Please fix this :)

developervisualapprovals commented 6 months ago

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 commented 6 months ago

I got the same problem too. Please fix it.

ThomasLoSG commented 6 months ago

Downgraded the RestSharp to 106.15.0 seems solved the problem

developervisualapprovals commented 6 months ago

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 commented 6 months ago

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

amyskippy commented 6 months ago

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 commented 6 months ago

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

developervisualapprovals commented 6 months ago

[sad] Ali Ashraf reacted to your message:


From: Anton Zherdev @.> Sent: Wednesday, January 3, 2024 11:18:08 PM To: XeroAPI/Xero-NetStandard @.> Cc: Ali Ashraf @.>; Comment @.> Subject: Re: [XeroAPI/Xero-NetStandard] Method not found: 'RestSharp.RestRequest RestSharp.RestRequestExtensions.AddFile(RestSharp.RestRequest, System.String, Byte[], System.String, System.String)'. (Issue #484)

Closed #484https://github.com/XeroAPI/Xero-NetStandard/issues/484 as completed.

— Reply to this email directly, view it on GitHubhttps://github.com/XeroAPI/Xero-NetStandard/issues/484#event-11383957053, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BCXKV5ZYAXCSACG63DN5IZLYMXRLBAVCNFSM6AAAAAA3RHMMV6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGM4DGOJVG4YDKMY. You are receiving this because you commented.Message ID: @.***>

antonzherdev commented 6 months ago

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