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

Bool? on .Net Core 2.1 it is not being bound on .Net Core 3.1 - Unable to cast object of type 'MongoDB.Bson.BsonBoolean' to type 'MongoDB.Bson.BsonArray'.

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 2.13.1
    • Component/s: BSON
    • Labels:
    • Environment:
      macOS Catalina 10.15.7, Mongo Atlas 4.4.8

      I had a project in .Net Core 2.1 that was working fine. One of my classes has a prop like:

      public bool? Terms { get; set; }

      Was working fine. After I upgraded to .Net Core 3.1, the old items of the collection started to throw  errors when biding to this prop.

      The wierd part is that the new regs created from 3.1, dont throw any error on the bind of this prop.

      The 2.1 reg and the the 3.1 has the same value on MongoDB:

      "Terms" : null

      For the old ones, the error thrown is:

      Unable to cast object of type 'MongoDB.Bson.BsonBoolean' to type 'MongoDB.Bson.BsonArray'.

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick@boutique-pool.com Patrick Ferraro
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: