InconsistentDataException when copying page with default values when using projects

Found in

EPiServer.CMS.Core 11.5.4

Fixed in

EPiServer.CMS.Core 11.9.1

Created

Jun 12, 2018

Updated

Jun 21, 2018

Area

CMS Core

State

Closed, Fixed and tested


Description

Steps to reproduce:

1) Add a string property to a StandardPage.

[Display(
GroupName = SystemTabNames.Content,
Order = 330)]
public virtual string TestString { get; set; }

2) Set a default value using the SetDefaultValues method.

public override void SetDefaultValues(ContentType contentType)
{
base.SetDefaultValues(contentType);
 
TestString = "ABC";
}

3) In CMS, edit the About us page and make sure the new property has no value.
4) Select a project or create one.
5) Try to copy and paste the About Us page.

Expected:
Copy is successful

Actual: Error message popup
"Failed to copy page 'About us' to 'Start'.:[Importing content 282_285] Exception: Tried to load long string with GUID 3598f010-0b4f-4849-b1f9-943584033013 but it was not found in the database"

Workaround: Edit stored procedure netContentListPaged and replace the value 2147483647 with 0 in the following code. Important, code appears in 2 places and both needs to be changed from:

COALESCE(LongStringLength, 2147483647)

to

COALESCE(LongStringLength, 0)

Alternative workaround if changing database is not an option: Disable delayed loading by setting stringDelayedLoadThreshold="0" in web.config.