-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 1.4.2
-
Component/s: None
-
None
To reproduce use this class:
public class C { public ObjectId Id; [BsonRepresentation(BsonType.ObjectId)] // applies to items not to array public string[] X; }
and this code:
var c = new C { X = new string[] { ObjectId.GenerateNewId().ToString(), ObjectId.GenerateNewId().ToString() } }; var json = c.ToJson(); Console.WriteLine(json); var d = BsonSerializer.Deserialize<C>(json); // throws exception because of this bug Console.WriteLine(d.ToJson());