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

Handle projections using constructors for classes that use public fields instead of public properties

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.19.1
    • Affects Version/s: 2.19.0
    • Component/s: None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Summary

      Projections invoking non-default constructors with parameters passed into them no longer work as of 2.19.0 with the LINQ3 provider unless the constructor's parameters match the names of the properties being pulled from the database. This used to work on LINQ3 all the way until 2.18.0, so it's a regression.

      MongoProjectionRegression.cs

      How to Reproduce

      Connect the provided repro to a test Mongo instance and run. It works on 2.18.0 with LINQ3, but not on 2.19.0 with LINQ3.

      As a control, it works on LINQ2 on both versions.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            alkis@fortunefish.co.uk Alkis Tsapanidis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: