We're updating the issue view to help you get more done. 

ToFuture provides ArgumentException at MultiQueryImpl.CreateCombinedQueryParameters

Description

We have next code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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

Status

Assignee

Unassigned

Reporter

Dmitriy Selischev

Components

Fix versions

Affects versions

4.1.0
4.1.1
4.0.4

Priority

Major