Empty recycle throws exception if many items in wastebasket

Found in

EPiServer.CMS.Core 10.6.0

Fixed in

EPiServer.CMS.Core 11.3.4


Feb 01, 2018


Feb 26, 2018


CMS Core


Closed, Fixed and tested


If a site has a large number of content items in the wastebasket (more than 5000), in some situations, depending on if all children are in the select query or not, you get an exception
Note: The exception is not visible to the user. You can see it if you activate Chrome's developer tools console.

Steps to reproduce

  1. Modify editeDeleteChilds with "select top 2" instead of "select top 5000" and try on an alloy site.
  2. Create some content in a chain of descendants (like a page with a childpage that has a childpage that has a childpage). # # Move the top content to trash and try to empty trash.
  3. You get an exception.

The exception.
The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "FK_tblContent_tblContent". The conflict occurred in database "episerverdb", table "dbo.tblContent", column 'fkParentID'