MutableDocument are not accepting decimal values

I’m using CB Lite v2.8.6 on Xamarin and creating a mutable document and passing document Id and object of type Dictionary<string, object> if the object has some decimal value it is throwing the following error.

System.ArgumentException : Decimal is not a valid type. You may only pass byte, sbyte, short, ushort, int, uint, long, ulong, float, double, bool, DateTimeOffset, Blob,, Blob, a one-dimensional array or a dictionary whose members are one of the preceding types.

code: var doc = new MutableDocument(Id, valueProps);

It works if I convert the decimal values to a string or integer.

valueProps = new Dictionary<string, object>{ {"id": "abcd"}, {"abc": "12"}, {"xyz": {"type":"something","id":"jsf..93sd","issued":"2015-06-29","quantity":{"value":100.0,"unit":"lb",},}} }

^^^ This wouldn’t work as the “value” is 100.0 (decimal)
valueProps = new Dictionary<string, object>{ {"id": "abcd"}, {"abc": "12"}, {"xyz": {"type":"something","id":"jsf..93sd","issued":"2015-06-29","quantity":{"value":"100.0","unit":"lb",},}} }

^^^ This work as the “value” is “100.0” (string)

Can anyone help on. how I could fix this issue?

I think that the error message you are getting explains the problem pretty clearly. Decimal (the type of 100.0 in your example) is not a supported type.

I would expect you to use double: 100.0D

I don’t see anywhere in the documentation that it doesn’t accept decimal values. I want to be sure I’m not doing anything wrong as it never says anywhere in the documentation that mutable Documents cannot accept decimals.

I would hope that this would make it clear:

Note that that list does not include Decimal

@blake.meike This works for all the values except 0. I tried converting it to 0D, 0.0D, Convert.ToDouble(0). but it is always throwing an error for 0 value in mutable document. Any suggestions?

It throws the same error you originally stated for 0.0D?

Yes, it throws the same error for that as well.