Skip to content

Commit c8c26a5

Browse files
committed
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.
1 parent af0a0f5 commit c8c26a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/NHibernate.Test/Linq/ByMethod/GroupByTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ public void GroupByTwoFieldsWhereOneOfThemIsTooDeep()
228228
{
229229
var query = (from ol in db.OrderLines
230230
let superior = ol.Order.Employee.Superior
231-
group ol by new {ol.Order.OrderId, SuperiorId = superior.EmployeeId}
231+
group ol by new { ol.Order.OrderId, SuperiorId = (int?)superior.EmployeeId }
232232
into temp
233233
select new
234234
{
235235
OrderId = (int?) temp.Key.OrderId,
236-
SuperiorId = (int?) temp.Key.SuperiorId,
236+
SuperiorId = temp.Key.SuperiorId,
237237
Count = temp.Count(),
238238
}).ToList();
239239

0 commit comments

Comments
 (0)