ToFuture provides ArgumentException at MultiQueryImpl.CreateCombinedQueryParameters

Description

We have next code:

var eventsRequestsResults = new List<IEnumerable<ISectionEvent>>(); while (enumerator.MoveNext()) { var eventRequest = Session.Query<ISectionEvent>() .Where(currentPredicate) .OrderBy(eventee => eventee.DateStart) .Fetch(eventee => eventee.RelatedSection) .ThenFetch(relatedSection => relatedSection.ParentSection) .ThenFetch(parentSection => parentSection.BaseGroup) .Take(currentMaxItems) .ToFuture(); eventsRequestsResults.Add(eventRequest); } eventsRequestsResults.First().ToList(); //This line throws ArgumentException.

-------------------

Exception throws at > NHibernate.dll!NHibernate.Impl.MultiQueryImpl.CreateCombinedQueryParameters() Line 632 C#

We have:
QueryParameters: p1,...,p10,p11
11 equal ToFuture queries

What actually happened: when CreateCombinedQueryParameters aggregates all parameters from all ToFuture queries into Dictionary then it apply a final parameter name as Concatenation(originalParamName, queryNumber)

So, for the first query(with zero-based number) final names:
p1+0 => p10, ... , p10+0 => p100, p11+0 => p110
For the 10th query final names:
p1+9 => p19, ... , p10+9 => p109, p11+9 => p119
And for the 11th query there is the first issue occurred:
p1+10 => p110, ... , p10+10 => p1010, p11+10 => p1110

Environment

None

Activity

Show:

Frédéric DelaporteMay 10, 2018 at 1:31 PM

Moved here

Dmitriy SelischevApril 12, 2017 at 4:26 PM

Issue can be fixed by adding underscore after original parameter name:
p1+_+10 => p1_10
p11+_+0 => p11_0

Dmitriy SelischevApril 12, 2017 at 4:05 PM
Edited

Example code here should be better to see

var eventsRequestsResults = new List<IEnumerable<ISectionEvent>>(); while (enumerator.MoveNext()) { var eventRequest = Session.Query<ISectionEvent>() .Where(currentPredicate) .OrderBy(eventee => eventee.DateStart) .Fetch(eventee => eventee.RelatedSection) .ThenFetch(relatedSection => relatedSection.ParentSection) .ThenFetch(parentSection => parentSection.BaseGroup) .Take(currentMaxItems) .ToFuture(); eventsRequestsResults.Add(eventRequest); } eventsRequestsResults.First().ToList(); //This line throws ArgumentException.
Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created April 12, 2017 at 3:59 PM
Updated May 10, 2018 at 1:31 PM
Resolved May 10, 2018 at 1:31 PM
Who's Looking?