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

Error in Auto class map with constructor parameter mismatch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.10.4
    • Fix Version/s: None
    • Component/s: Serialization
    • Labels:
      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

            Assignee:
            Unassigned Unassigned
            Reporter:
            alkampfer Gian Maria Ricci
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: