pappabj0rn
Mar 22, 2010
  5781
(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
My blog is now running using Optimizely CMS!

It's official! You are currently reading this post on my shiny new Optimizely CMS website.  In the past weeks, I have been quite busy crunching eve...

David Drouin-Prince | Jan 12, 2025 | Syndicated blog

Developer meetup - Manchester, 23rd January

Yes, it's that time of year again where tradition dictates that people reflect on the year gone by and brace themselves for the year ahead, and wha...

Paul Gruffydd | Jan 9, 2025

Side by side editing - alternative to Optimizely On-Page Edit

Combining the All Properties Mode with a self-updating preview in the Optimizely CMS

Bartosz Sekula | Jan 9, 2025 | Syndicated blog

ImageFile alt-description validation attribute

A customer wanted to improve their quality of having meta descriptive texts on all their published images but it was ok that it could take some tim...

Per Nergård | Jan 7, 2025