Closed gavinblanshard closed 6 years ago
Thanks for the report. This is a duplicate of https://github.com/braintree/braintree_dotnet/issues/64 , and we will remove the generate
methods in the next major version which we are working towards. It is recommended to use version 3.8.0
for now if possible, or to fork the repository and compile the library.
Ah! Thanks for the info. Sorry, I didn't see #64. I guess I assumed it would still be an open issue.
I have an interim workaround in case others need it. The call:
Dim token As String = gateway.ClientToken.Generate(New ClientTokenRequest())`
can be replaced with:
Dim token As String = String.Empty
Dim param(0) As Object
param(0) = New ClientTokenRequest()
token = PaymentGateway.ClientToken.GetType().InvokeMember(
"Generate",
Reflection.BindingFlags.InvokeMethod,
Nothing,
PaymentGateway.ClientToken,
param)
General information
Issue description
Version 3.9.0 of the Braintree .NET Client Library (installed via the NuGet Package Manager) seems to have a change that breaks it for VB.NET. Unlike C#, VB.NET is not case sensitive so does not permit two methods with the same name that differ only in upper/lower case letters. The ClientToken.Generate method now gives the following error preventing compilation:
The Braintree IClientTokenGateway interface appears to declare the following methods:
The two methods “Generate” and “generate” are treated as different by C#, but they are seen as the same in VB.NET - hence it is ambiguous as to which one is being referenced and therefore gives the error reported above.
I would much rather be using C# but legacy code makes that impractical!