Details
-
Bug
-
Resolution: Done
-
Major - P3
-
1.4.2
-
None
-
None
Description
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());
|