Open
Description
John Thornborrow created an issue — 26th February 2016, 21:59:14:
Happens with any mapped entity, where aNumber is greater than the number of results:
Session.Query<Entity>().Skip(aNumber).Count()Or an example case for us in pagination:
var recordsOnThisPage = Session.Query<Entity>().Skip((pageNumber - 1) * recordsPerPage).Take(recordsPerPage).Count()Will result in:
System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) at System.Collections.Generic.List`1.System.Collections.IList.get_Item(Int32 index) at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression nhLinqExpression, IQuery query, NhLinqExpression nhQuery) at NHibernate.Linq.DefaultQueryProvider.Execute(Expression expression) at NHibernate.Linq.DefaultQueryProvider.Execute<TResult>(Expression expression) at System.Linq.Queryable.Count<TSource>(IQueryable`1 source)
Ricardo Peres added a comment — 27th February 2016, 11:01:10:
Are you sure on this? I cannot reproduce it!
Please submit a failing unit test.
John Thornborrow added a comment — 24th March 2016, 22:25:50:
https://github.com/Jestar342/NHibernateIssues/blob/master/NHibernateIssues/SkipCount.cs