-
Type: Bug
-
Resolution: Duplicate
-
Priority: Blocker - P1
-
None
-
Affects Version/s: 1.3.1
-
Component/s: None
-
Fully Compatible
Possibly related to CSHARP-284 and CSHARP-308?
I noticed in the various serializers in Bson/Serialization/Serializers/ that the Deserialize and Serialize methods were ignoring the given IBsonSerializationOptions. Is this by design?
I recently came across an issue by attempting to use the BsonRepresentationAttribute on a collection, e.g.:
[BsonRepresentation(BsonType.Int64, AllowOverflow = true)]
public List<UInt64> Ids
Then I hit an OverflowException when calling ToJson on my object:
System.OverflowException: Arithmetic operation resulted in an overflow.
at MongoDB.Bson.Serialization.Options.RepresentationSerializationOptions.ToInt64(UInt64 value)
at MongoDB.Bson.Serialization.Serializers.UInt64Serializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options)
at MongoDB.Bson.Serialization.BsonClassMapSerializer.SerializeMember(BsonWriter bsonWriter, Object obj, BsonMemberMap memberMap)
at MongoDB.Bson.Serialization.BsonClassMapSerializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options)
at MongoDB.Bson.Serialization.BsonSerializer.Serialize(BsonWriter bsonWriter, Type nominalType, Object value, IBsonSerializationOptions options)
at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType, IBsonSerializationOptions options, JsonWriterSettings settings)
at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType, JsonWriterSettings settings)
at MongoDB.Bson.BsonExtensionMethods.ToJson(Object obj, Type nominalType)
at MongoDB.Bson.BsonExtensionMethods.ToJson[TNominalType](TNominalType obj)
- duplicates
-
CSHARP-284 Add a way to provide serialization attributes to be applied to collection elements
- Closed