-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Description of the Bug
We have a class that has a property for ChargeBee.Models.Subscription. When we try and serialize this parent class we get an exception with the following details:
Error getting value from 'SubscriptionId' on 'ChargeBee.Models.Subscription+SubscriptionContractTerm'.
The property subscription_id is not present!
If I look in the debug visualizer and drill down to the ChargeBeeSubscription.ContractTerm.SubscriptionId I see a circular red-X for the property, and the value is:
"'(new System.Collections.Generic.ICollectionDebugView<Bemo.Services.ShoppingCart.Models.BemoCartLineItem>(value.LineItems).Items[0]).BemoSub.ChargeBeeSubscription.ContractTerm.SubscriptionId' threw an exception of type 'System.ArgumentException'"
If I clone the latest chargebee-dotnet repository, include the project in my solution, and then comment out the SubscriptionContractTerm.SubscriptionId property in Subscription.cs (lines 6540-6542) then the serialization works as expected. ETA: I can also change that property so the call the GetValue() sets the "required" parameter to false.
Steps to reproduce
- Create a parent class with a ChargeBee.Models.Subscription
- Populate the parent class, including the CB Subscription property
- Try and Serialize the parent class with Newtonsoft
- Error/exception as noted in description
Expected Behavior
Serialization should not throw this exception.
Code Snippets (if applicable)
No response
Operating System
Windows 10/11
Language version
.Net 8.0
Library version
v3.20.0
Additional context
No response