From: Sergey K. (JIRA) <nh...@gm...> - 2011-05-19 12:45:53
|
Count() after Cast<>() causes InvalidOperationException ------------------------------------------------------- Key: NH-2717 URL: http://216.121.112.228/browse/NH-2717 Project: NHibernate Issue Type: Bug Components: Linq Provider Affects Versions: 3.1.0 Reporter: Sergey Karpushev Priority: Major Attachments: CastCount.patch patch for with a test and fix attached Test 'NHibernate.Test.Linq.ByMethod.CastTests.CastCount' failed: System.InvalidOperationException : No coercion operator is defined between types 'System.Int32' and 'NHibernate.DomainModel.Northwind.Entities.Animal'. at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType) at System.Linq.Expressions.Expression.Convert(Expression expression, Type type) at Remotion.Data.Linq.Clauses.ResultOperators.CastResultOperator.GetNewItemExpression(Expression inputItemExpression) at Remotion.Data.Linq.Clauses.ResultOperators.CastResultOperator.GetOutputDataInfo(IStreamedDataInfo inputInfo) Linq\Visitors\QueryModelVisitor.cs(133,0): at NHibernate.Linq.Visitors.QueryModelVisitor.VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, Int32 index) at Remotion.Data.Linq.Clauses.ResultOperatorBase.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index) at Remotion.Data.Linq.QueryModelVisitorBase.VisitResultOperators(ObservableCollection`1 resultOperators, QueryModel queryModel) at Remotion.Data.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel) Linq\Visitors\QueryModelVisitor.cs(108,0): at NHibernate.Linq.Visitors.QueryModelVisitor.Visit() Linq\Visitors\QueryModelVisitor.cs(59,0): at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, Boolean root) Linq\NhLinqExpression.cs(67,0): at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory) Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs(27,0): at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryIdentifier, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) Engine\Query\HQLExpressionQueryPlan.cs(34,0): at NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators(String expressionStr, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) Engine\Query\HQLExpressionQueryPlan.cs(23,0): at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String expressionStr, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) Engine\Query\HQLExpressionQueryPlan.cs(17,0): at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String expressionStr, IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) Engine\Query\QueryPlanCache.cs(88,0): at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters) Impl\AbstractSessionImpl.cs(312,0): at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow) Impl\AbstractSessionImpl.cs(268,0): at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression) Linq\NhQueryProvider.cs(43,0): at NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression, IQuery& query, NhLinqExpression& nhQuery) Linq\NhQueryProvider.cs(26,0): at NHibernate.Linq.NhQueryProvider.Execute(Expression expression) Linq\NhQueryProvider.cs(103,0): at NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression expression) at System.Linq.Queryable.Count[TSource](IQueryable`1 source) Linq\ByMethod\CastTests.cs(36,0): at NHibernate.Test.Linq.ByMethod.CastTests.CastCount() -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-20 13:58:57
|
[ http://216.121.112.228/browse/NH-2717?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Fabio Maulo resolved NH-2717. ----------------------------- Resolution: Fixed Fix Version/s: 3.2.0CR1 > Count() after Cast<>() causes InvalidOperationException > ------------------------------------------------------- > > Key: NH-2717 > URL: http://216.121.112.228/browse/NH-2717 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.1.0 > Reporter: Sergey Karpushev > Priority: Major > Fix For: 3.2.0CR1 > > Attachments: CastCount.patch > > > patch for with a test and fix attached > Test 'NHibernate.Test.Linq.ByMethod.CastTests.CastCount' failed: System.InvalidOperationException : No coercion operator is defined between types 'System.Int32' and 'NHibernate.DomainModel.Northwind.Entities.Animal'. > at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType) > at System.Linq.Expressions.Expression.Convert(Expression expression, Type type) > at Remotion.Data.Linq.Clauses.ResultOperators.CastResultOperator.GetNewItemExpression(Expression inputItemExpression) > at Remotion.Data.Linq.Clauses.ResultOperators.CastResultOperator.GetOutputDataInfo(IStreamedDataInfo inputInfo) > Linq\Visitors\QueryModelVisitor.cs(133,0): at NHibernate.Linq.Visitors.QueryModelVisitor.VisitResultOperator(ResultOperatorBase resultOperator, QueryModel queryModel, Int32 index) > at Remotion.Data.Linq.Clauses.ResultOperatorBase.Accept(IQueryModelVisitor visitor, QueryModel queryModel, Int32 index) > at Remotion.Data.Linq.QueryModelVisitorBase.VisitResultOperators(ObservableCollection`1 resultOperators, QueryModel queryModel) > at Remotion.Data.Linq.QueryModelVisitorBase.VisitQueryModel(QueryModel queryModel) > Linq\Visitors\QueryModelVisitor.cs(108,0): at NHibernate.Linq.Visitors.QueryModelVisitor.Visit() > Linq\Visitors\QueryModelVisitor.cs(59,0): at NHibernate.Linq.Visitors.QueryModelVisitor.GenerateHqlQuery(QueryModel queryModel, VisitorParameters parameters, Boolean root) > Linq\NhLinqExpression.cs(67,0): at NHibernate.Linq.NhLinqExpression.Translate(ISessionFactoryImplementor sessionFactory) > Hql\Ast\ANTLR\ASTQueryTranslatorFactory.cs(27,0): at NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String queryIdentifier, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) > Engine\Query\HQLExpressionQueryPlan.cs(34,0): at NHibernate.Engine.Query.HQLExpressionQueryPlan.CreateTranslators(String expressionStr, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) > Engine\Query\HQLExpressionQueryPlan.cs(23,0): at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String expressionStr, IQueryExpression queryExpression, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) > Engine\Query\HQLExpressionQueryPlan.cs(17,0): at NHibernate.Engine.Query.HQLExpressionQueryPlan..ctor(String expressionStr, IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) > Engine\Query\QueryPlanCache.cs(88,0): at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow, IDictionary`2 enabledFilters) > Impl\AbstractSessionImpl.cs(312,0): at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression queryExpression, Boolean shallow) > Impl\AbstractSessionImpl.cs(268,0): at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression queryExpression) > Linq\NhQueryProvider.cs(43,0): at NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression, IQuery& query, NhLinqExpression& nhQuery) > Linq\NhQueryProvider.cs(26,0): at NHibernate.Linq.NhQueryProvider.Execute(Expression expression) > Linq\NhQueryProvider.cs(103,0): at NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression expression) > at System.Linq.Queryable.Count[TSource](IQueryable`1 source) > Linq\ByMethod\CastTests.cs(36,0): at NHibernate.Test.Linq.ByMethod.CastTests.CastCount() -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |