-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Critical - P2
-
None
-
Affects Version/s: 1.9.2
-
Component/s: Serialization
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
I need to serialize a BsonDocument using the DataContractSerializer.
I have a class Play that has a BsonDocument (see stub below).
[BsonIgnoreExtraElements]
[DataContract(Namespace="f1")]
public class Play
{
...
[DataMember][BsonElement] public BsonDocument OD
}
Note: the first element in the BsonDocument is a BsonInt32.
When using the DataContractSerializer, I get the following error:
Type 'MongoDB.Bson.BsonInt32' with data contract name 'BsonInt32:http://schemas.datacontract.org/2004/07/MongoDB.Bson' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.