Details
Assignee
UnassignedUnassignedReporter
Konstantin GoncharovKonstantin GoncharovComponents
Affects versions
Priority
MinorWho's Looking?
Open Who's Looking?
Details
Details
Assignee
Unassigned
UnassignedReporter
Konstantin Goncharov
Konstantin GoncharovComponents
Affects versions
Priority
Who's Looking?
Open Who's Looking?
Created July 28, 2017 at 7:25 AM
Updated August 2, 2017 at 12:56 PM
A null reference exception is thrown when a Linq select query contains a cast to primitive type but the query returns
null
for the field.By example, when
x.Id
is typed asobject
but is mapped as int, andClass1.Field
isint
:or when
NestedField.Id
isint
, butx.NestedField
isnull
:This was working with NHibernate 3.x, but it throws with 4.x.
I have investigated this issue and found a solution for me in class
NHibernate.Linq.Visitors.SelectClauseVisitor
:I catch
NullReferenceException
when result is converted to property type: