Open
Description
Issue Summary
This is a dotnetcore application running on dotnet 7. When attempting to instatiate a ITwilioRestClient via dependency injection, I get the following exception:
System.MissingMethodException: 'Method not found: 'Void Twilio.Clients.TwilioRestClient..ctor(System.String, System.String, System.String, System.String, Twilio.Http.HttpClient, System.String)'.'
This is happening on twilio 7.6.0. If I roll back to twilio 7.5.1 the bug does not occur.
Steps to Reproduce
- Nuget to install twilio version 7.6.0
- Configure twilio in startup.cs
- Attempt to instantiate a ITwilioRestClient via DI
Code Snippet
Here's my code to create the service in startup.cs
services.AddTwilioClient(optionsToConfigure =>
{
auction4.Services.Utility.TwilioUtil.SetOptions(Configuration, optionsToConfigure);
});
Then the exception occurs when my razor page loads:
private readonly ITwilioRestClient _twilioClient;
private readonly IConfiguration _configuration;
public TwilioSendModel(IConfiguration configuration,
ITwilioRestClient twilioClient)
{
_twilioClient = twilioClient;
_configuration = configuration;
}
Exception/Log
System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'Void Twilio.Clients.TwilioRestClient..ctor(System.String, System.String, System.String, System.String, Twilio.Http.HttpClient, System.String)'.
Source=Twilio.AspNet.Core
StackTrace:
at Twilio.AspNet.Core.TwilioClientDependencyInjectionExtensions.CreateTwilioClient(IServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
Technical details:
- twilio-csharp version: 7.6.0
- csharp version: 7