I have noticed that from past few deployments to DXC I see this error
"EPiServer.Cms.Shell.UI.Rest.ContentChangeManager : Unexpected error when saving 19234_158862System.Data.SqlClient.SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkContentProperty_tblPropertyDefinition". The conflict occurred in database "epicms"", table "dbo.tblPropertyDefinition"", column 'pkID'.However after redeployment this error is no more. Any inputs on why this error occurs and fixes after redeployment without any changes.
I have no experience with DXP (the experience platform formerly known as DXC) but I think you probably have done changes to a content type (added or removed a property, added or changed a page type or block type) after the previous deploy. If DXP has two deployment slots using the same database, two different versions of your code are fighting over the same database.
After the second deploy, both slots will have the same code, and the fighting stops. I think this is the explanation. I do not know the solution.
A workaround could be running two consecutive deploys after a content type is changed. That is what I do when deploying an Episerver site to Azure (non-DXP) using deployment slots.
Looks like one or more of your content types does not have a guid, causing mapping mismatch between strongly typed content types (code) and database. If that is the case then adding GUID property to ContentType attribute would solve the problem
All of my content types do have GUID's and are created using EpiServer options so they definitely be same in Database vs code. I have not edited any of page types or manually added/edited guids.
For some reason I have seen that I dont get this issue when I use maintenance page when doing deployment. Not sure what the difference would be but for now am going to validate and use this option.
One of my clients encountered the same issue recently. Client fixed this issue by quickly restart the WebApp.
Vincent, I have observed it too that a redeployment or restart of web app fixes it.