Breaking change in serialization from 1.7.1 to 1.8.1

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Critical - P2
    • None
    • Affects Version/s: 1.8.1
    • Component/s: None
    • Environment:
      Windows client, Windows server
    • None
    • Major Change
    • None
    • None
    • None
    • None
    • None
    • None

      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?

            Assignee:
            Robert Stam (Inactive)
            Reporter:
            Stefano Ricciardi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: