braintree / braintree_dotnet

Braintree .NET library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
136 stars 73 forks source link

Calling WebhookNotification.Parse(signature, payload) in .NET Core 3.1 Results In System.IO.FileNotFoundException #96

Closed StephenMP closed 4 years ago

StephenMP commented 4 years ago

General information

Issue description

When attempting to parse a webhook notification in a .NET Core 3.1 project, calling WebhookNotification.Parse(signature, payload) results in an exception.

Exception Type: System.IO.FileNotFoundException

Exception Message: Could not load file or assembly 'System.Xml.XPath.XmlDocument, Version=4.0.2.0'. The system cannot find the file specified.

Exception Stack Trace: at Braintree.NodeWrapper.GetNode(String path) at Braintree.NodeWrapper.GetString(String path) at Braintree.NodeWrapper.GetDateTime(String path) at Braintree.WebhookNotification..ctor(NodeWrapper node, IBraintreeGateway gateway) at Braintree.WebhookNotificationGateway.Parse(String signature, String payload)

StephenMP commented 4 years ago

This issue is caused by something in the Microsoft SDKs for Azure Functions. Using Microsoft.NET.Sdk.Functions v. 3.0.5 causes this issue; however, using v. 3.0.3 everything works just fine. I'm going to close the issue since it's related to Microsoft's SDK and not Braintree's SDK :)

kcrandall commented 4 years ago

I got this same error. Using Microsoft.NET.Sdk.Functions v. 3.0.7. I called:

Result<Transaction> result = await Credentials.Gateway.Transaction.SaleAsync(request);`

It would complete the sale and then cause an exception and not return anything. So my system had no clue the sale had happened and a lot of charges happened as duplicates causing a lot of problems. Is there anyway to move this library away from any XML dependencies and use only json? Json.Net is always stable and wouldn't cause this problem. Probably one of those bugs from Microsoft moving toward unifying .NET 5 and away from core/.net framework/.net standard.

I opened https://github.com/Azure/azure-functions-vs-build-sdk/issues/428 to address this