IContentLoader.TryGet throws an EPiServerException if the reference's content type is no longer defined in code.



When running IContentLoader.TryGet(ContentReference contentReference, ILanguageSelector languageSelector, out T Content), if the content reference's content type was defined by code that no longer exits, then an EPiServerException is thrown with the following message:

"Could not create instance of content type "PartsCartContent" since it has an invalid .NET class associated: XXXXX.PartsCartContent, XXXXX.Shop, Version=, Culture=neutral, PublicKeyToken=null"

This happens for custom content type named "PartsCartContent" that inherited from EPiServer.Core.ContentBase (i.e. it's neither a page nor a block) before being deleted.

Instead of throwing an Exception I'd suggest that IContentLoader.TryGet(...) returns false if the above error occurs.

I'm using EPiServer CMS 9.12.2.

Mar 22, 2017 17:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.