If I have a query against like this against northwind
select new {c.Address, c.City, CompanyName = (string)null, c.ContactName, c.ContactTitle, c.Country, c.CustomerId, c.Fax, c.Phone, c.PostalCode, c.Region}
It will fail with a ArgumentNullException which on the face of it is fair enough,
but if instead of the anonymous you where projecting into a constructor e.g
var queryable = from c in GetNorthwindLinqMetaData().Customer
select new CustomerVM(c.Address, c.City, null, c.ContactName, c.ContactTitle, c.Country, c.CustomerId, c.Fax, c.Phone, c.PostalCode, c.Region);
queryable.ToList();
It will also fail, which means you can't pass a literal null to constructor which doesn't seem so fair.
Thoughts?
One of our developers ran into this when he tried to reuse a constructor by passing nulls rather than creating a new one, his knee jerk reaction to this (and any other linq to DB) problem was too ToList() before the projection and prefetch
To repro see http://rapiddevbookcode.codeplex.com/SourceControl/changeset/view/84374#1647590