We're updating the issue view to help you get more done. 

Linq - does not support GetValueOrDefault() for Nullable<bool>

Description

System.InvalidCastException : Unable to cast object of type 'NHibernate.Hql.Ast.HqlCoalesce' to type 'NHibernate.Hql.Ast.HqlBooleanExpression'.
at NHibernate.Hql.Ast.HqlTreeNodeExtensions.AsBooleanExpression(HqlTreeNode node) in HqlTreeNode.cs: line 123
at NHibernate.Linq.Visitors.QueryModelVisitor.VisitWhereClause(WhereClause whereClause, QueryModel queryModel, Int32 index) in QueryModelVisitor.cs: line 261
at Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection`1 bodyClauses, QueryModel queryModel)
at Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)
at NHibernate.Linq.Visitors.QueryModelVisitor.Visit() in QueryModelVisitor.cs: line 140
at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, Boolean root) in QueryModelVisitor.cs: line 86
at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory, Boolean filter) in NhLinqExpression.cs: line 67
at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) in ASTQueryTranslatorFactory.cs: line 24
at NHibernate.Engine.Query.QueryExpressionPlan.CreateTranslators(IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in QueryExpressionPlan.cs: line 32
at NHibernate.Engine.Query.QueryExpressionPlan..ctor(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) in QueryExpressionPlan.cs: line 14
at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters) in QueryPlanCache.cs: line 67
at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow) in AbstractSessionImpl.cs: line 412
at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression) in AbstractSessionImpl.cs: line 372
at NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression, ref IQuery query, ref NhLinqExpression nhQuery) in DefaultQueryProvider.cs: line 73
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) in DefaultQueryProvider.cs: line 39
at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) in DefaultQueryProvider.cs: line 46
at Remotion.Linq.QueryableBase`1.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at NHibernate.Test.NHSpecificTest.NH3100.NullableBooleanFixture.GetValueOrDefaultTrue() in ByCodeFixture.cs: line 121

Environment

None

Status

Assignee

Alexander Zaytsev

Reporter

Alexander Zaytsev

Labels

Components

Affects versions

3.2.0.GA

Priority

Trivial