U4-8786 - Member search in listview returns error (7.5-beta2)

Created by Sebastiaan Janssen 28 Jul 2016, 11:37:11 Updated by Sebastiaan Janssen 05 Aug 2016, 11:04:52

Tags: Unscheduled

Relates to: U4-8779

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: Parameter '@2' specified but only 2 parameters supplied (in SELECT cmsMember.nodeId FROM [cmsMember] INNER JOIN [cmsContentVersion] ON [cmsContentVersion].[ContentId] = [cmsMember].[nodeId] INNER JOIN [cmsContent] ON [cmsContentVersion].[ContentId] = [cmsContent].[nodeId] INNER JOIN [cmsContentType] ON [cmsContentType].[nodeId] = [cmsContent].[contentType] INNER JOIN [umbracoNode] ON [cmsContent].[nodeId] = [umbracoNode].[id] WHERE (([umbracoNode].[nodeObjectType] = @0)) AND ((umbracoNode.[text] LIKE @1) OR (cmsMember.LoginName LIKE @2)))

The last bit of the query should read: AND ((umbracoNode.[text] LIKE @1) OR (cmsMember.LoginName LIKE @1)) - so two times @1 instead of @1 and @2

We're supposed to be searching on members and the filter for LoginName and umbracoNode.Text should be the same.

at Umbraco.Core.Persistence.Database.<>c__DisplayClass29_0.b__0(Match m) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\PetaPoco.cs:line 404 at System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat) at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator, Int32 count, Int32 startat) at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator) at Umbraco.Core.Persistence.Database.ProcessParams(String _sql, Object[] args_src, List1 args_dest) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\PetaPoco.cs:line 393 at Umbraco.Core.Persistence.Sql.Build(StringBuilder sb, List1 args, Sql lhs) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\PetaPoco.cs:line 2444 at Umbraco.Core.Persistence.Sql.Build() in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\PetaPoco.cs:line 2390 at Umbraco.Core.Persistence.Sql.get_SQL() in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\PetaPoco.cs:line 2399 at Umbraco.Core.Persistence.Repositories.VersionableRepositoryBase2.GetSortedSqlForPagedResults(Sql sql, Direction orderDirection, String orderBy, Boolean orderBySystemField) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\Repositories\VersionableRepositoryBase.cs:line 269 at Umbraco.Core.Persistence.Repositories.VersionableRepositoryBase2.GetPagedResultsByQuery[TDto,TContentBase](IQuery1 query, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, Tuple2 nodeIdSelect, Func2 processQuery, String orderBy, Direction orderDirection, Boolean orderBySystemField, Func1 defaultFilter) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\Repositories\VersionableRepositoryBase.cs:line 372 at Umbraco.Core.Persistence.Repositories.MemberRepository.GetPagedResultsByQuery(IQuery1 query, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, String orderBy, Direction orderDirection, Boolean orderBySystemField, String filter) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Persistence\Repositories\MemberRepository.cs:line 631 at Umbraco.Core.Services.MemberService.GetAll(Int64 pageIndex, Int32 pageSize, Int64& totalRecords, String orderBy, Direction orderDirection, Boolean orderBySystemField, String memberTypeAlias, String filter) in D:\Dev\Umbraco-CMS\src\Umbraco.Core\Services\MemberService.cs:line 720 at Umbraco.Web.Editors.MemberController.GetPagedResults(Int32 pageNumber, Int32 pageSize, String orderBy, Direction orderDirection, Boolean orderBySystemField, String filter, String memberTypeAlias) in D:\Dev\Umbraco-CMS\src\Umbraco.Web\Editors\MemberController.cs:line 94 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Web.Http.Filters.ActionFilterAttribute.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.ActionFilterAttribute.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()

Comments

Sebastiaan Janssen 28 Jul 2016, 11:51:17

I tried to have a look, but most of the related code seems unchanged for a long time so I'm not sure why it is suddenly failing.


Shannon Deminick 04 Aug 2016, 16:03:41

PetaPoco is just odd so even though it's using the same SQL parameter value, PetaPoco will try to parse the numerical values in the SQL based on the number of parameters. So for the members where clause, we'll build up the clause with a true parameter for each column, even though it's the same value.

PR is here: https://github.com/umbraco/Umbraco-CMS/pull/1412

this fixes up using the StringBuilder so it's not manually concatenating strings and allocating extra memory.


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.5.0

Due in version: 7.5.0

Sprint: Sprint 39

Story Points:

Cycle: