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

Error in Auto class map with constructor parameter mismatch

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 2.10.4
    • Serialization
    • None

    Description

      If you create a C# class with a property of type array and the constructor accepts an IEnumerable for that parameter the driver is not able to map the class.

      Attached program that raises the exception. But basically here is the problem, this class triggers the error

      public class TestArray
      {
      public TestArray(String id, IEnumerable<String> values)

      { Id = id; Values = values.ToArray(); }

      public String Id { get; private set; }

      public String[] Values { get; private set; }
      }

      This happens because the constructor accepts a parameter vlaues THAT HAS THE SAME NAME OF A PROPERTY BUT DIFFERENT TYPE, this generates the exception.

      Also the error is not present if properties setters are public (because the mapper directly map properties). 

      Actually this is a serious bug, I've updated driver on a project of mine and I have tons of test failing for such classes.

      Everything was fine with 2.7 driver.

      Attachments

        Activity

          People

            Unassigned Unassigned
            alkampfer@nablasoft.com Gian Maria Ricci
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: