Developer forum

Forum » CMS - Standard features » Exception when saving item type

Exception when saving item type

Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hello,

We're getting an issue with saving an item type on a site. Here's the top part of the stack trace as seen in the backend when clicking 'Save' on an item type record.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Dynamicweb.Content.Items.Queries.Repository.AreListsEqual(ItemList itemListA, ItemList itemListB) +15
   Dynamicweb.Content.Items.Queries.Repository.CheckItemRelationListSynchronization(Item masterItem, Item languageItem) +552
   Dynamicweb.Content.Items.Queries.Repository.SynchronizePageStructure(Item currentItem, Boolean updateModificationDate, Item originalItem, ItemContext context, Page page) +793
   Dynamicweb.Content.Items.Queries.Repository.SynchronizePageStructure(Item currentItem, Boolean updateModificationDate, Item originalItem, ItemContext context) +349

This is for a site with 12 language layers. I was able to determine that the issue is that the table 'Page' had empty PagePropertyItemId values in the database, and the AreListsEqual is failing on that. First, as a side issue, when that issue occurs, it would be nice to have it handled with a more useful handled error message.

It appears that the Pages have lost their reference to their item type. Our oldest backup from about a month ago still had this issue, so it went bad at some point in the past without us realizing until now. I can resolve it by setting PagePropetyItemId (or break a known good one by removing that).

Are there any known issues with that field getting dropped? I can share the site if that would be helpful, but I don't know that there are any historical logs that will be of use. My main question is to see if this is known and if there is anything that I should consider for what may have caused this.

Thanks,

Scott


Replies

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Never mind this. I found that it was an issue way back in a backup we have from DW8. So this went haywire years ago. I'm sure it's too long ago to figure out the backstory.

My only recomendation is to turn this into a handled exception. It looks like it's purposefully trying to check if the lists are equal, but it's not responding in a handled way if there is a problem. 

To repro, create a page based item type and edit the Page in the database to set PagePropertyItemId to an emtpy string. Clear the cache and then try to edit the record and save it. It should throw this exception. 

 

You must be logged in to post in the forum