LinqV3 Projection ObjectId deserialization error

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 2.19.0
    • Affects Version/s: 2.15.1, 2.17.1
    • Component/s: LINQ3
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      LinqProvider V3 failed to materialize a C# projection object (defined class, not an anomymous class) from a C# source object with an ObjectId string serializer : An error occurred while deserializing the Id property of class ConsoleApp.Projections.IdObjectBase: Cannot deserialize a 'String' from BsonType 'ObjectId'.

      Tested with MongoDb driver 2.17.1 and 2.15.1 over local MongoDb instance.

      How to Reproduce

      See C# .Net6 attached project that reproduces the error.

      Additional Background

      ObjectId deserialization is working as expected when using LinqProvider.V2.

      I really think that deserialization MUST use the C# source object serialization configuration over the projection.

      Please note that it is working fine (and as expected) when using an anomyous object for projection with LinqProvider.V3.

              Assignee:
              Robert Stam
              Reporter:
              Laurent Jeancler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: