Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim 43 posts 197 karma points
    Jun 24, 2020 @ 10:54
    Tim
    0

    Error in Security Tree

    Hiya,

    I've installed TeaCommerce 3.4.2 on Umbraco 7.15.3. It all installs fine, but after the app restarts the trees/sections are broken, the error tat I get is:

    System.InvalidOperationException: Sequence contains more than one matching element
    at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
       at umbraco.BusinessLogic.User.GetApplications()
       at TeaCommerce.Umbraco.Application.Trees.SecurityTree.GetUsers()
       at TeaCommerce.Umbraco.Application.Trees.SecurityTree.CreateRootNode(XmlTreeNode& rootNode)
       at umbraco.cms.presentation.Trees.BaseTree.Initialize()
       at umbraco.cms.presentation.Trees.BaseTree.SetTreeParameters(ITreeService treeParams)
       at Umbraco.Web.Trees.ApplicationTreeExtensions.TryGetRootXmlNodeFromLegacyTree(ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper)
       at Umbraco.Web.Trees.ApplicationTreeExtensions.TryGetRootNodeFromLegacyTree(ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper, String currentSection)
       at Umbraco.Web.Trees.ApplicationTreeController.<GetRootForMultipleAppTree>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at Umbraco.Web.Trees.ApplicationTreeController.<GetApplicationTrees>d__0.MoveNext()
    

    The full error in the trace log for the site is:

    2020-06-24 11:48:21,168 [P5296/D42/T117] ERROR Umbraco.Web.Editors.SectionController - Unhandled controller exception occurred
    System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Sequence contains more than one matching element
       at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
       at umbraco.BusinessLogic.User.GetApplications()
       at TeaCommerce.Umbraco.Application.Trees.SecurityTree.GetUsers()
       at TeaCommerce.Umbraco.Application.Trees.SecurityTree.CreateRootNode(XmlTreeNode& rootNode)
       at umbraco.cms.presentation.Trees.BaseTree.Initialize()
       at umbraco.cms.presentation.Trees.BaseTree.SetTreeParameters(ITreeService treeParams)
       at Umbraco.Web.Trees.ApplicationTreeExtensions.TryGetRootXmlNodeFromLegacyTree(ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper)
       at Umbraco.Web.Trees.ApplicationTreeExtensions.TryGetRootNodeFromLegacyTree(ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper, String currentSection)
       at Umbraco.Web.Trees.ApplicationTreeController.<GetRootForMultipleAppTree>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at Umbraco.Web.Trees.ApplicationTreeController.<GetApplicationTrees>d__0.MoveNext()
       --- End of inner exception stack trace ---
       at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
       at Umbraco.Web.Editors.SectionController.GetSections()
       at lambda_method(Closure , Object , Object[] )
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
       at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
    ---> (Inner Exception #0) System.InvalidOperationException: Sequence contains more than one matching element
       at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
       at umbraco.BusinessLogic.User.GetApplications()
       at TeaCommerce.Umbraco.Application.Trees.SecurityTree.GetUsers()
       at TeaCommerce.Umbraco.Application.Trees.SecurityTree.CreateRootNode(XmlTreeNode& rootNode)
       at umbraco.cms.presentation.Trees.BaseTree.Initialize()
       at umbraco.cms.presentation.Trees.BaseTree.SetTreeParameters(ITreeService treeParams)
       at Umbraco.Web.Trees.ApplicationTreeExtensions.TryGetRootXmlNodeFromLegacyTree(ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper)
       at Umbraco.Web.Trees.ApplicationTreeExtensions.TryGetRootNodeFromLegacyTree(ApplicationTree appTree, FormDataCollection formCollection, UrlHelper urlHelper, String currentSection)
       at Umbraco.Web.Trees.ApplicationTreeController.<GetRootForMultipleAppTree>d__1.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at Umbraco.Web.Trees.ApplicationTreeController.<GetApplicationTrees>d__0.MoveNext()<---
    

    Has anyone come across this before?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 24, 2020 @ 11:09
    Matt Brailsford
    0

    Hi Tim,

    Best I could suggest to try is double check your config\trees.config file and make sure you don't have a duplicate entry for tea-commerce-security-tree or any of the other TC trees for some reason.

    Not sure why you would, but that's my best initial guess.

    Matt

  • Tim 43 posts 197 karma points
    Jun 24, 2020 @ 11:24
    Tim
    0

    Hi Matt,

    Thanks for the quick response! There's no duplicate entry in the trees.config file I'm afraid, if I comment out the security tree from trees.config the back office starts working again, albeit the Teacommerce section no longer has the security section in it. There's no duplicates that I can see in the user group permission DB tables either.

    I think the error is here: https://github.com/umbraco/Umbraco-CMS/blob/master-v7/src/umbraco.businesslogic/User.cs on line 230. It looks like it's maybe getting multiple copies of the application somehow. I've checked the applications.config file and there are no duplicates there that I can see either.

  • Tim 43 posts 197 karma points
    Jun 24, 2020 @ 12:46
    Tim
    100

    Hi Matt,

    After a lot of digging, I finally managed to resolve this. The site I'm installing on has several custom sections, one of them was being registered multiple times in code, and one of the core API methods the security tree calls blows up if there's multiple sections with the same alias.

    I've removed the duplicate registration and it all seems good now! Thanks for your help looking into this, it's much appreciated :)

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Jun 24, 2020 @ 13:08
    Matt Brailsford
    0

    No problem.

    Glad you got it figured out.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft