Try our conversational search powered by Generative AI!

pappabj0rn
Mar 22, 2010
  5664
(1 votes)

NullReferenceException in EnsureAllPageTypeProperties()

Last night while working on one of my sites, I needed to go into edit mode and have a look at my site structure. I was greeted by this lovely error message instead of my page tree:

System.NullReferenceException: Object reference not set to an instance of an object.
   at EPiServer.Core.PropertyDataCollection.EnsureAllPageTypeProperties()
   at EPiServer.Core.PropertyDataCollection.InitializeData()
   at EPiServer.Core.PageData.InitializeData(IList`1 pageLanguages)
   at EPiServer.DataAccess.PageListDB.ReadPageList(AbstractCommand cmd)
   at EPiServer.DataAccess.PageListDB.<>c__DisplayClass11.<LoadSpecificPages>b__10()
   at EPiServer.DataAccess.DataAccessBase.<>c__DisplayClass1`1.<Execute>b__0()
   at EPiServer.DataAccess.DatabaseFactory.Execute[TResult](Action`1 method)
   at EPiServer.DataAccess.DataAccessBase.Execute[TResult](Action`1 action)
   at EPiServer.LocalPageProvider.GetPages(PageReferenceCollection pageReferences, ILanguageSelector selector)
   at EPiServer.Core.PageProviderBase.GetScatteredPages(PageReferenceCollection pageRefs, ILanguageSelector selector)
   at EPiServer.Core.PageProviderBase.GetChildren(PageReference pageLink, ILanguageSelector selector, Int32 startIndex, Int32 maxRows)
   at EPiServer.DataFactory.GetChildren(PageReference pageLink, ILanguageSelector selector, Int32 startIndex, Int32 maxRows)
   at EPiServer.DataFactory.GetChildren(PageReference pageLink, ILanguageSelector selector)
   at EPiServer.Web.WebControls.PageDataSource.GetChildrenForLoader(PageReference pageLink)
   at EPiServer.Web.WebControls.HierarchicalPageLoader.GetFilteredChildren(PageReference pageLink)
   at EPiServer.Web.WebControls.PageHierarchyData.EnsureChildrenLoaded()
   at EPiServer.Web.WebControls.PageHierarchyData.get_HasChildren()
   at EPiServer.UI.WebControls.PageTreeView.PopulateChildNodes(IHierarchicalEnumerable enumerable, Int32 depth, Int32 expandDepth, PageTreeNode parentNode, ArrayList populationPath)
   at EPiServer.UI.WebControls.PageTreeView.PopulateChildNodes(IHierarchicalEnumerable enumerable, Int32 depth, Int32 expandDepth, PageTreeNode parentNode, ArrayList populationPath)
   at EPiServer.UI.WebControls.PageTreeView.PopulateChildNodes(IHierarchicalEnumerable enumerable, Int32 depth, Int32 expandDepth, PageTreeNode parentNode, ArrayList populationPath)
   at EPiServer.UI.WebControls.PageTreeView.PopulateRecursive(String viewPath)
   at EPiServer.UI.WebControls.PageTreeView.PerformDataBinding()
   at System.Web.UI.WebControls.HierarchicalDataBoundControl.PerformSelect()
   at EPiServer.UI.Edit.PageExplorer.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   --- End of inner exception stack trace ---
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at ASP.gui_edit_edittree_aspx.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Then I remembered, “oh, yeah… the tree broke down when I upgraded to R2 sp2 last week”. I didn’t have much choice but to tend to my page tree.

The stack trace doesn’t give you much info as to what went wrong, but it also so happens that I use Allan’s DCPlugin (which took down my site after the upgrade – fixed it by adding a quick check-for-null-patch), which, just like EnsureAllPageTypeProperties(), juggles with PropertyData. All of this indicates that something is wrong with some of my property types (property plug-ins), and sure enough, after modifying DCPlugin to throw me some detailed info, I found that some modules I was using didn’t work in my current sp2 installation. After removing the corresponding dlls, and the definitions in my database, my page tree sprung to life once more.

I’m not sure what was wrong with the modules, and since I’m not sure I’ll be using them I have yet to give a damn.

Bottom line

If something goes wrong in EPiServer.Core.PropertyDataCollection.EnsureAllPageTypeProperties(), something is wrong with your property type(s).

Mar 22, 2010

Comments

Please login to comment.
Latest blogs
Why C# Developers Should Embrace Node.js

Explore why C# developers should embrace Node.js especially with Optimizely's SaaS CMS on the horizon. Understand the shift towards agile web...

Andy Blyth | May 2, 2024 | Syndicated blog

Is Optimizely CMS PaaS the Preferred Choice?

As always, it depends. With it's comprehensive and proven support for complex business needs across various deployment scenarios, it fits very well...

Andy Blyth | May 2, 2024 | Syndicated blog

Adding market segment for Customized Commerce 14

Since v.14 of commerce, the old solution  for adding market segment to the url is not working anymore due to techinal changes of .NET Core. There i...

Oskar Zetterberg | May 2, 2024

Blazor components in Optimizely CMS admin/edit interface

Lab: Integrating Blazor Components into Various Aspects of Optimizely CMS admin/edit interface

Ove Lartelius | May 2, 2024 | Syndicated blog