C# automap issue when parameter name is "items"

Hi,

I just saw a very strange behaviour, maybe you can explain… but it looks like a bug.
I have some very simple valueobjects as classes in my code.
Some of them can be created with a public constructor passing an IEnumerable with parameter name “items”.
For my purpose I don’t need any custom BsonClassMaps because automap works fine so far…

This does not work

public class PrNumbers : ListValueObject<PrNumbers>
    {
        public PrNumbers(IEnumerable<PrNumbers> items) : base(items) { }
    }

MongoDB.Bson.BsonSerializationException: Creator map for class …PrNumbers has 1 arguments, but none are configured.

This does work

public class PrNumbers : ListValueObject<PrNumbers>
    {
        public PrNumbers(IEnumerable<PrNumbers> prnumbers) : base(prnumbers) { }
    }

The only change is just the parameter name… nothing else… any idea why?

Best regards,
Simon

Hi @Simon_Schweizer, welcome!

Looks like the exception happened on MongoDB.Bson/Serialization/BsonCreatorMap.cs#L147.

Could you provide a minimal reproducible example application of the above ? Also, which version of MongoDB .NET/C# driver are you using ?

Regards,
Wan.