Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-756

Breaking change in serialization from 1.7.1 to 1.8.1

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 1.8.1
    • None
    • Windows client, Windows server
    • Major Change

    Description

      We are in the process of upgrading our code to use driver 1.8.1.

      Code now compiles fine after removing the warning for obsoletes function calls. However our acceptance tests are raising exceptions of the following kind:

      "MongoDB.Bson.Serialization.Serializers.BsonDocumentSerializer can only be used with type MongoDB.Bson.BsonDocument, not with type xxx.Resource."

      Resource is a custom class of ours extending BsonDocument and implementing a custom interface.

      For example the exception is thrown by the second line in the following snippet:

      MongoCollection<Resource> Entities = mongo.DB.GetCollection<Resource>("mycollection");
      Resource found = Entities.FindOneByIdAs<Resource>("abc");

      This used to work fine in 1.7.1 and all previous versions.

      Any tip?

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            stefanoric Stefano Ricciardi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: