SelectMany not working

Although this isn’t strictly related to M220N, I’m using the sample_nflix database and the C# classes from M220N, so I thought this would be a good place to ask. Can someone explain to me why the second query fails with “No matching creator found.” ? I’m using driver version 2.14.1

            var mongoClient = new MongoClient("mongodb://localhost/");
            var db = mongoClient.GetDatabase("sample_mflix");
            var movies = db.GetCollection<Movie>("movies");

            var m1 = movies.AsQueryable()
                .SelectMany(m => m.Directors, (m, d) => new { Director = d, Title = m.Title })
                .Where(m => m.Director == "Susumu Kudo")
                .ToList();

            var m2 = movies.AsQueryable()
                .SelectMany(m => m.Directors, (m, d) => new { Director = d, Title = m.Title, Runtime = m.Runtime })
                .Where(m => m.Director == "Susumu Kudo")
                .ToList();

Hi, Joris,

Thank you for filing CSHARP-4075 with your question. This is expected behaviour and has to do with how BsonClassMaps for anonymous types are created and limitations of the C# compiler. I provided a full explanation in the ticket as well as two potential workarounds.

Sincerely,
James