When opening the Presentation Details dialog for an item (e.g. the Standard Values for a template) a null reference exception is thrown.
[ArgumentNullException: Value cannot be null. Parameter name: value] Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName) +105 Sitecore.Web.WebUtil.SafeEncode(String value) +84 Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm.RenderRenderings(DeviceDefinition deviceDefinition, Int32 selectedIndex, Int32 index) +1682 Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm.Refresh() +622 Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm.OnLoad(EventArgs e) +703
The issue arises when the placeholder XML-attribute (“ph”) is missing from one or more of the elements in the “Renderings”-field.
I honestly can’t say when or why some of the “ph”-attributes went missing, as the solution in question is 2+ years old and started out as Sitecore 6.6 Update-2. All I know is that earlier versions of Sitecore handled the circumstance gracefully.
If you know what causes this issue, please leave a comment 🙂
This article is based on a Sitecore 8 Update-2 (rev. 150223).
To fix the problem, follow these steps:
- Open the “View” tab and check “Standard fields” and “Raw values”.
- Copy the contents of the “Renderings”-field into a text editor, e.g. Visual Studio.
- Search for any “r”-elements which do not contain a “ph”-attribute.
- Add an empty “ph”-attribute to these elements.
- Copy and paste the modified XML back into the “Renderings”-field.
- Save the item.