Permalink
Browse files

GroupByTests.cs: In GroupByTwoFieldsWhereOneOfThemIsTooDeep() we get …

…a NullReferenceException from inside the result transformer lambda when running on .Net 4. Perhaps there is something deep in .Net framework that differs between 2.0 and 4.0?. In any case, casting to (int?) already in the group expression resolves this, which seems like a reasonable fix given that an employee may indeed lack a superior.
  • Loading branch information...
1 parent af0a0f5 commit c8c26a5c967cfb183a651e2813546e97cc1d202c @oskarb oskarb committed Oct 6, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/NHibernate.Test/Linq/ByMethod/GroupByTests.cs
@@ -228,12 +228,12 @@ public void GroupByTwoFieldsWhereOneOfThemIsTooDeep()
{
var query = (from ol in db.OrderLines
let superior = ol.Order.Employee.Superior
- group ol by new {ol.Order.OrderId, SuperiorId = superior.EmployeeId}
+ group ol by new { ol.Order.OrderId, SuperiorId = (int?)superior.EmployeeId }
into temp
select new
{
OrderId = (int?) temp.Key.OrderId,
- SuperiorId = (int?) temp.Key.SuperiorId,
+ SuperiorId = temp.Key.SuperiorId,
Count = temp.Count(),
}).ToList();

0 comments on commit c8c26a5

Please sign in to comment.