Skip to content

LINQ queries with a cast from int to uint fail #2445

Closed
@razzmatazz

Description

@razzmatazz

This is a regression from 5.2.7.

The following LINQ query fails with NotSupportedException: Don't currently support idents of type UInt32 (pseudo code):

int propertyId = 1;
var list = await db.Query<Model>().Where(item => item.Property.Id == (uint)propertyId).ToListAsync();

Where Model.Property.Id is declared as an uint.

Callstack is:

NHibernate.Hql.Ast.HqlIdent..ctor(IASTFactory factory, Type type)
NHibernate.Hql.Ast.HqlCast..ctor(IASTFactory factory, HqlExpression expression, Type type)
NHibernate.Hql.Ast.HqlTreeBuilder.Cast(HqlExpression expression, Type type)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.VisitUnaryExpression(UnaryExpression expression)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.VisitExpression(Expression expression)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.TranslateEqualityComparison(BinaryExpression expression)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.VisitBinaryExpression(BinaryExpression expression)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.VisitExpression(Expression expression)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.Visit(Expression expression)
NHibernate.Linq.Visitors.HqlGeneratorExpressionVisitor.Visit(Expression expression, VisitorParameters parameters)
NHibernate.Linq.Visitors.QueryModelVisitor.VisitWhereClause(WhereClause whereClause, QueryModel queryModel, int index)
Remotion.Linq.Clauses.WhereClause.Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index)
Remotion.Linq.QueryModelVisitorBase.VisitBodyClauses(ObservableCollection<IBodyClause> bodyClauses, QueryModel queryModel)
Remotion.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel)
NHibernate.Linq.Visitors.QueryModelVisitor.Visit()
NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, bool root, Nullable<NhLinqExpressionReturnType> rootReturnType)
NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory, bool filter)
NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IQueryExpression queryExpression, string collectionRole, bool shallow, IDictionary<string, IFilter> filters, ISessionFactoryImplementor factory)
NHibernate.Engine.Query.QueryExpressionPlan.CreateTranslators(IQueryExpression queryExpression, string collectionRole, bool shallow, IDictionary<string, IFilter> enabledFilters, ISessionFactoryImplementor factory)
NHibernate.Engine.Query.QueryExpressionPlan..ctor(IQueryExpression queryExpression, bool shallow, IDictionary<string, IFilter> enabledFilters, ISessionFactoryImplementor factory)
NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, bool shallow, IDictionary<string, IFilter> enabledFilters)
NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, bool shallow)
NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression)
NHibernate.Linq.DefaultQueryProvider.PrepareQuery(Expression expression, out IQuery query)
NHibernate.Linq.DefaultQueryProvider.ExecuteListAsync<TResult>(Expression expression, CancellationToken cancellationToken)
NHibernate.Linq.LinqExtensionMethods+<>c__DisplayClass59_0<TSource>+<<ToListAsync>g__InternalToListAsync|0>d.MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions