Server Error in '/' Application.

Index was outside the bounds of the array.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:


Line 9:      var model = new GlobalSearch();
Line 10:     var rootNode = PageHelper.GetRootNode();
Line 11:     List<IPublishedContent> productCategory = rootNode.Children.Where(x => x.DocumentTypeAlias.ToLower() == "productcategory").ToList();
Line 12:     int maxLevel = 4;
Line 13:     var MainUlClass = "";

Source File: d:\BulbtronicSite_New\BulbtronicsProd\Views\Partials\Navigation\_Navigation.cshtml    Line: 11

Stack Trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
   System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +14821457
   Umbraco.Core.Models.EntityBase.TracksChangesEntityBase.OnPropertyChanged(PropertyInfo propertyInfo) +58
   Umbraco.Core.Models.EntityBase.TracksChangesEntityBase.SetPropertyValueAndDetectChanges(Func`2 setValue, T value, PropertyInfo propertySelector) +61

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
   System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) +35
   Umbraco.Core.Models.DeepCloneHelper.DeepCloneRefProperties(IDeepCloneable input, IDeepCloneable output) +1712
   Umbraco.Core.Models.EntityBase.Entity.DeepClone() +62
   Umbraco.Core.Models.ContentTypeBase.DeepClone() +18
   Umbraco.Core.Models.ContentTypeCompositionBase.DeepClone() +18
   Umbraco.Core.Persistence.Caching.RuntimeCacheProvider.GetByIds(Type type, List`1 ids) +471
   Umbraco.Core.Persistence.Repositories.RepositoryBase`2.GetAll(TId[] ids) +199
   Umbraco.Core.Persistence.Repositories.RepositoryBase`2.GetByQuery(IQuery`1 query) +27
   Umbraco.Core.Services.ContentTypeService.GetContentType(String alias) +526
   Umbraco.Core.Models.PublishedContent.PublishedContentType.CreatePublishedContentType(PublishedItemType itemType, String alias) +151
   Umbraco.Core.Cache.<>c__DisplayClass9`1.<GetCacheItem>b__8() +18
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +87
   Umbraco.Core.Cache.CacheProviderExtensions.GetCacheItem(ICacheProvider provider, String cacheKey, Func`1 getCacheItem) +171
   Umbraco.Core.Models.PublishedContent.PublishedContentType.Get(PublishedItemType itemType, String alias) +313
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent.Initialize() +2341
   Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedContent.get_SortOrder() +25
   System.Linq.EnumerableSorter`2.ComputeKeys(TElement[] elements, Int32 count) +105
   System.Linq.EnumerableSorter`1.Sort(TElement[] elements, Int32 count) +29
   System.Linq.<GetEnumerator>d__1.MoveNext() +267
   System.Linq.WhereEnumerableIterator`1.MoveNext() +236
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +436
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +70
   ASP._Page_Views_Partials_Navigation__Navigation_cshtml.Execute() in d:\BulbtronicSite_New\BulbtronicsProd\Views\Partials\Navigation\_Navigation.cshtml:11
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +194
   System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper htmlHelper, String partialViewName) +96
   ASP._Page_Views_Base_cshtml.Execute() in d:\BulbtronicSite_New\BulbtronicsProd\Views\Base.cshtml:72
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +147
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +304
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +123
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +88
   System.Web.WebPages.WebPageBase.PopContext() +379
   Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) +194
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +31
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +436
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +187
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +27
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +41
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4087.0