Unable to set Configuration
property after instantiating since 5.0.0
#122
Labels
Configuration
property after instantiating since 5.0.0
#122
General information
Issue description
Hi,
Our previous method of instantiating
BraintreeGateway
was to do something like this:Where
CustomBraintreeConfiguration
inherits fromBraintree.Configuration
.Since 5.0.0, instantiating
BraintreeGateway
like this causes all HTTP calls to break with aNullReferenceException
(from trying to accessEnvironment.GatewayURL
here).I can see in the 5.0.0 commit that many classes now use the static property
gateway.Service
instead of instantiating a new service usinggateway.Configuration
. Sincegateway.Service
is assigned during theBraintreeGateway
constructor, settingConfiguration
on the gateway after instantiation will always meanEnvironment
is null.Spent quite a while debugging this, and I think more people could run into this issue unless you either make the
Configuration
read-only or throw a more descriptive error. This breaking change also wasn't in the 5.0.0 changelog or the v5 migration guide.Thanks!
The text was updated successfully, but these errors were encountered: