-
Notifications
You must be signed in to change notification settings - Fork 397
Closed
Labels
Description
When deserializing "malformed", non-round-trip JSON where unexpected values are encountered, a stack overflow occurs.
For example, when deserializing the following JSON to an object where both properties are Power
{
"ChargePower": {
"Unit": "PowerUnit.Kilowatt",
"Value": 11.0
},
"DischargePower": 12.0
}
then the latter triggers an infinite loop in this code:
if (valueUnit == null) | |
{ | |
return token.ToObject<IQuantity>(serializer); | |
} |
I guess there could be a nicer way of handling this. Maybe interpreting the value as the base unit of Power
or throwing an exception?
Also, thanks for making this great library! 👍