Umb V13.8.1 with Umbraco.Community.BlockPreview V1.13.2
We are now a few months into a build project and all of a sudden, after adding a simple docType with a block Grid that’s used all over the place, any block that is added to a new page returns a red header block saying “The document type is invalid”.
Have tried clearing caches, rebuilding models, etc. Even deleting the new docType, but the issue remains. We can add blocks to existing pages but not to new pages of any type.
This originally happened with Umbraco.Community.BlockPreview V1.13.0, but still happens on V1.13.2.
If anyone has any ideas how to get out of this I’d love to hear them as this is a proper show-stopper.
Thanks.
Hey @craigs100! Thanks for pointing this out. This looks similar to another issue that had been raised on the BlockPreview repo and I think I’ve got another idea for a potential fix…
Watch this space 
1 Like
Really appreciate the fast response Rick 
We’d be extremely grateful for a fix if you can find the time 
Hi @rickbutterfield . I’m helping Craig with this. The issue is that GetContentType is returning null in the BlockPreviewService when the content type does actually exist. I’ve commented out the lines that use the cache and that solves it so somehow either the cache is storing a null or not working properly… Hope that helps.
2 Likes
Exactly what I thought it would be! I’ve already got a NotificationHandler
to clear the cached DataTypes when you save a DataType, but not got one to clear the cached ContentTypes when they’re saved!
Just giving it a test now…
1 Like
@rickbutterfield The odd thing is it happens from a fresh start so the caches should be clear then anyway…
@rickbutterfield The value in the cache is a Umbraco.Cms.Core.Models.PublishedContent.PublishedContentType, which does not cast to IContentType, hence why we are getting a null returned. PublishedContentType derives from IPublishedContentType not IContentType. Not sure if this helps! Strange though it works for pages already created and it only an issue for new pages we are trying to create.
1 Like
This is what is in the runtime cache:
No idea how the venture page (which is the problematic one) ends up in the cache as a Published ContentType?!?!
Update:
@rickbutterfield I think the issue is in GetPublishedContent in BlockPreviewApiController, when content is null is is adding the content type to the runtime cache via the published content. this I think is returning a different model.
Update:
@rickbutterfield Confirmed, it’s exactly as described above:
Perfect. This is really helpful! Fix incoming…
3 Likes
Would that be V1.13.4 by any chance?
That’s the one! Please give it a try and report back 
Works for me. Thanks for the super-quick response 
2 Likes