Try our conversational search powered by Generative AI!

Content Tree Not Showing

Vote:
 

Recently, the Content Tree in the left pane is not appearing in our Epi 9.9 project.  The Root name and Icon appear, but the three blue bars to the left of the name continuously cycle and the tree will not appear.  Looking in Fiddler I noticed there was a 500 error when trying to load the following url

/EPiServer/cms/Stores/contentstructure/?referenceId=1&query=getchildren&typeIdentifiers=episerver.core.pagedata&allLanguages=true&sort()&dojo.preventCache=1464715414299

I copied the url into a new browser tab and was able to see the following error:

The given key was not present in the dictionary.

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.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 

[KeyNotFoundException: The given key was not present in the dictionary.]
   System.Collections.Generic.Dictionary`2.get_Item(TKey key) +11575989
   EPiServer.DataAccess.ContentListDB.ReadCommonMetadata(DbDataReader reader, Dictionary`2 allFetchedItems) +131
   EPiServer.DataAccess.ContentListDB.ReadPublishedList(DbCommand cmd) +378
   EPiServer.DataAccess.<>c__DisplayClass24_0.b__0() +857
   EPiServer.Data.Providers.<>c__DisplayClass28_0`1.b__0() +89
   EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute(Func`1 method) +104
   EPiServer.Data.Providers.SqlDatabaseHandler.Execute(Func`1 action) +319
   EPiServer.DataAccess.ContentListDB.LoadSpecificContentInstances(IList`1 contentLinks, Int32 languageBranchID) +184
   EPiServer.DataAbstraction.ContentStore.LoadSpecificContentInstances(IList`1 contentLinks, Int32 languageBranchID) +67
   EPiServer.<>c__DisplayClass17_0.b__0(IList`1 refs) +91
   EPiServer.DefaultContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader) +288
   EPiServer.DefaultContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector) +486
   EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector) +1214
   EPiServer.Core.ContentProvider.LoadBatched(IList`1 contentReferences, ILanguageSelector selector) +65
   EPiServer.Core.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions) +334
   EPiServer.Core.DefaultContentLoader.GetChildren(ContentReference contentLink, LoaderOptions loaderOptions, Int32 startIndex, Int32 maxRows) +2735
   EPiServer.Core.DefaultContentLoader.GetChildren(ContentReference contentLink, LoaderOptions loaderOptions) +105
   EPiServer.Core.DefaultContentRepository.GetChildren(ContentReference contentLink, LoaderOptions loaderOptions) +113

We've checked all Block Types and Content Types on the Admin > Content Type tab and there is no missing properties.  I've also checked in the database and verified all the content types exist in the database.  Is there a way to determine what content, page type or property could be throwing this error?

Thanks in advance!

#149428
May 31, 2016 19:28
Vote:
 

I haven't seen this error myself, but how about decompiling Epi and see what it does with GetChildren and kind of loaderoptions are created in Episerver/CMS/stores/contentstructure?

guess you could find inspiration to create something that does getchildren to recreate the issue in your own code that you can debug.

another tip is to use the browser built in developer tools, the console and network functions can easier let you see what traffic EPiServer is using so that you don't need to switch back and forth between browser and fiddler. Even if Fiddler usually is a great tool! :)

#149438
Jun 01, 2016 7:52
Vote:
 

Alf, thank you for your response. I was able to resolve the issue and get the Content Tree to appear.  Steps to resolve the issue are below:

First I tried to get all the children from the root using the following statement

var children = DataFactory.Instance.GetChildren(ContentReference.RootPage);


This threw the same error as mentioned in my post above.

So, I then used the GetDescendents to get a listing of all the Page References and then looped through those Page References performing a GetPage on each one:

            var descendentLinks = DataFactory.Instance.GetDescendents(ContentReference.RootPage);

            foreach (var link in descendentLinks)
            {
                Debug.WriteLine(link.ID);
                try
                {
                    var descendent = DataFactory.Instance.GetPage(link, LanguageSelector.AutoDetect(true));
                }
                catch (Exception ex)
                {
                   Debug.WriteLine(ex.Message);
                }
                
            }

In my output I received an error regarding content ID 147 that it did not contain a Language entry in the tblContentLanguage table. Once I added a row in the tblContentLanguage table for that Content ID, the Content Tree rendered.

#149491
Jun 01, 2016 17:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.