cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

The type initializer for 'AuthorizeNet.Api.Controllers.Bases.ApiOperationBase`2' threw an exception

We are using .NET 3.1 and the .NET Core SDK Beta for our integration solution and are experiencing a vague error message when the following line attempts to execute. I'm not sure how to proceed. Any insight would be great.

 

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

 

TypeInitializationException: The type initializer for 'AuthorizeNet.Api.Controllers.Bases.ApiOperationBase`2' threw an exception.

AuthorizeNet.Api.Controllers.Bases.ApiOperationBase<TQ, TS>.set_RunEnvironment(Environment value)

MissingMethodException: Method not found: 'Microsoft.Extensions.Logging.ILoggerFactory Microsoft.Extensions.Logging.DebugLoggerFactoryExtensions.AddDebug(Microsoft.Extensions.Logging.ILoggerFactory, Microsoft.Extensions.Logging.LogLevel)'.

AuthorizeNet.Utilities.LogFactory.get_LoggerFactory()

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

If anyone runs into this problem in the future, my pull request below makes the minor changes needed for this to at least run in .NET Core 3.1+. 

 

.NET Core 3.1+ Compatibility by michaelbernat ยท Pull Request #20 ยท AuthorizeNet/dotnet-core-sdk-beta...

View solution in original post

3 REPLIES 3

Issue was that the .NET Core SDK does not fully support .NET Core 3.1. Some of the method calls in the SDK were deprecated in the 2.x releases of .NET Core, so I downloaded the SDK source and corrected these. After publishing the changes to a nupkg, it's working like a charm. Still have a long ways to go with integration but at least this roadblock is cleared ;)

If anyone runs into this problem in the future, my pull request below makes the minor changes needed for this to at least run in .NET Core 3.1+. 

 

.NET Core 3.1+ Compatibility by michaelbernat ยท Pull Request #20 ยท AuthorizeNet/dotnet-core-sdk-beta...

We are using .NET 3.1 and the .NET Core SDK Beta for our integration solution and are experiencing a vague error message when the following line attempts to execute.