Skip to content

Regression in caching linq query with ThenFetchMany statement. #2559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
illkostinf opened this issue Sep 21, 2020 · 0 comments
Closed

Regression in caching linq query with ThenFetchMany statement. #2559

illkostinf opened this issue Sep 21, 2020 · 0 comments

Comments

@illkostinf
Copy link
Contributor

Starting from nhibernate 5.3 while retrieving cached result of linq query with ThenFetchMany statement, nhibernate throws
"System.NullReferenceException" with following call stack:

at NHibernate.Type.AbstractType.GetHashCode(Object x)
at NHibernate.Type.AbstractType.GetHashCode(Object x, ISessionFactoryImplementor factory)
at NHibernate.Engine.CollectionKey.GenerateHashCode()
at NHibernate.Engine.CollectionKey..ctor(String role, Object key, IType keyType, ISessionFactoryImplementor factory)
at NHibernate.Engine.CollectionKey..ctor(ICollectionPersister persister, Object key)
at NHibernate.Type.CollectionType.BeforeAssemble(Object oid, ISessionImplementor session)
at NHibernate.Type.TypeHelper.BeforeAssemble(Object[] row, ICacheAssembler[] types, ISessionImplementor session)
at NHibernate.Cache.StandardQueryCache.PerformBeforeAssemble(ICacheAssembler[] returnTypes, ISessionImplementor session, IList cacheable)
at NHibernate.Cache.StandardQueryCache.GetResultFromCacheable(QueryKey key, ICacheAssembler[] returnTypes, Boolean isNaturalKeyLookup, ISessionImplementor session, IList cacheable)
at NHibernate.Cache.StandardQueryCache.Get(QueryKey key, ICacheAssembler[] returnTypes, Boolean isNaturalKeyLookup, ISet`1 spaces, ISessionImplementor session)
at NHibernate.Cache.StandardQueryCache.Get(QueryKey key, QueryParameters queryParameters, ICacheAssembler[] returnTypes, ISet`1 spaces, ISessionImplementor session)
at NHibernate.Cache.QueryCacheExtensions.Get(IQueryCache queryCache, QueryKey key, QueryParameters queryParameters, ICacheAssembler[] returnTypes, ISet`1 spaces, ISessionImplementor session)
at NHibernate.Loader.Loader.GetResultFromQueryCache(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces, IQueryCache queryCache, QueryKey key)
at NHibernate.Loader.Loader.ListUsingQueryCache(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces)
at NHibernate.Loader.Loader.List(ISessionImplementor session, QueryParameters queryParameters, ISet`1 querySpaces)
at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters queryParameters, ISessionImplementor session, IList results)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results, Object filterConnection)
--- End of inner exception stack trace ---
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results, Object filterConnection)
at NHibernate.Impl.SessionImpl.List(IQueryExpression queryExpression, QueryParameters queryParameters, IList results)
at NHibernate.Impl.AbstractSessionImpl.List[T](IQueryExpression query, QueryParameters parameters)
at NHibernate.Impl.AbstractQueryImpl2.List[T]()
at NHibernate.Linq.DefaultQueryProvider.ExecuteList[TResult](Expression expression)
at NHibernate.Linq.NhQueryable`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at NHibernate.Test.NHSpecificTest.CachingComplexQuery.ByCodeFixture.<>c__DisplayClass3_0.<TestQueryCachingWithThenFetchMany>b__4()

An unit test that reproduces the above bug is contained in pull request #2558.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants