I've had some issues with a block failing with a NullReferenceException for a while now. After a lot of debugging I was finally able to trace the reason to a deleted block that is still referenced in one of the ContentAreas. It's not visible from anywhere, including All Properties, but looking in the database I found it there among all the other valid contents of that particular ContentArea:
<div data-classid="..." data-contentgroup=""
data-contentguid="X" data-contentname="[some name, valid]">{}</div><div data-classid="..." data-contentgroup=""
data-contentguid="Y" data-contentname="[some name, seemingly valid]">{}</div><div data-classid="..." data-contentgroup=""
data-contentguid="Z" data-contentname="[some name, valid]">{}</div>
(this is from the LongString column in tblContent for the ContentArea property on the parent block)
Looking up all the contentguids, I found everyone but "Y".
So my question is; how do I clean this up? Of course I could probably just edit this row in the database directly, and that's fine for dev, but for a production environment it involves a fair amount of red tape I'd prefer to avoid if possible.
And if anyone has any theories on how this could happen in the first place, I'd love to hear them.