Details
-
Bug
-
Resolution: Duplicate
-
Unknown
-
None
-
None
-
None
Description
Members fields in this loop can be null (and in line 59).
Repro:
static void Main(string[] args) |
{
|
var client = new MongoClient(new MongoClientSettings() { LinqProvider = Linq.LinqProvider.V3}); |
var db = client.GetDatabase("d"); |
var coll = db.GetCollection<Root>("c"); |
|
|
coll.InsertOne(new Root() { ForSelectMany = new[] { new WitDateTimeOffset { Date = DateTimeOffset.UtcNow} } }); |
|
|
var res = coll.AsQueryable()
|
.SelectMany(x => x.ForSelectMany)
|
.Select(y => new OutputWithMonth(y.Date.Month)) |
.ToList();
|
}
|
|
|
|
|
private class Root |
{
|
public IEnumerable<WitDateTimeOffset> ForSelectMany { get; internal set; } |
}
|
|
|
public class WitDateTimeOffset |
{
|
public DateTimeOffset Date { get; set; } |
}
|
|
|
private class OutputWithMonth |
{
|
public int Month; |
|
|
public OutputWithMonth(int month) => Month = month; |
}
|
Attachments
Issue Links
- duplicates
-
CSHARP-3922 LINQ3: support calls to constructors in Select
-
- Closed
-