Twilio RestSharp Dependency

I just updated the MVC web application running on ASP.NET Framework version 4.5.2. I use Twilio to send an SMS:

var twilio = new TwilioRestClient(twilioSid, twilioAuthToken); var result = twilio.SendSmsMessage(twilioNumber, message.Destination, message.Body); 

After updating, I get the following error:

System.TypeLoadException: Failed to load type "RestSharp.HttpBasicAuthenticator" from the assembly "RestSharp", Version = 105.2.1.0, Culture = neutral, PublicKeyToken = null '.

Installed Versions:

  • Twilio 4.0.4
  • RestSharp 105.2.1

I saw a similar question published back in November 2014 (8 months ago), and there is also a discussion. The Twilio Nuget page discusses an alpha version that is reportedly removing the dependency on RestSharp.

Can someone tell me what the status of the project is and what version options should be used?

Thanks.

+6
twilio restsharp
source share
1 answer

Twilio evangelist developer is here.

We had to “block” the twilio-csharp library to version 105.0.1 due to the fact that every time RestSharp is updated, we need to release a new version or fix the errors that they present in the library. It seems they just updated the library on August 16th, which will completely remove the Basic Authenticator module from the library

Now, since you say that you upgraded RestSharp to version 105.2.1, I believe that you will do this by going to the Nuget Package Manager and clicking "Update All", which will then update your packages, regardless of what is described on the package. config (even this file will be updated).

To fix this, all you have to do is go to the package manager console and run the following:

 Install-Package RestSharp -Version 105.1.0 

This will return your .config package to use the correct version, and your project should work again.

package manager console

As for your second question, we are working on a version of Alpha that uses a deprived version of RestSharp, but, unfortunately, is not yet safe for production.

Hope this solves your problem.

UPDATE: Just thought I'd add an update here so you know that I added a new version of a package that supports Restsharp 105.2.1

+9
source share

All Articles