Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

An error occurred while deserializing the property of class Truncation resulted in data loss.

//This means that there was an exception casting from a more detailed object to a less

//Solution A:
JObject.Parse(
  JsonConvert.SerializeObject(
    BsonTypeMapper.MapToDotNetValue(bson)
  )
);

//Solution B: mapping and setting allowTruncation: true
//This is done at the startup level

BsonSerializer.RegisterSerializer(
                typeof(float),
                new DoubleSerializer(
                    BsonType.Double,
                    new RepresentationConverter(
                        allowOverflow: true,
                        allowTruncation: true
                    )
                )
            );
 
PREVIOUS NEXT
Tagged: #An #error #occurred #deserializing #property #class #Truncation #resulted #data
ADD COMMENT
Topic
Name
1+4 =