Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

PageData.IsVisibleOnSite throws InvalidCastException when the PageData-instance is a shortcut to an image

Vote:
 

When you call the IsVisibleOnSite-extension method of the PageData-class and the PageData-instance is a shortcut to an ImageFile(ImageData), an InvalidCastException is thrown.

So the IsVisibleOnSite-method is checking the target of the shortcut and assuming it is also of type PageData(?).

Exception message: Unable to cast object of type 'Castle.Proxies.ImageFileProxy' to type 'EPiServer.Core.PageData'.

Is this expected behaviour or a bug? 

EPiServer version is 11.3.0

#195720
Aug 06, 2018 12:26
Vote:
 

We might just discover it at one pet dog shop in the higher Seattle location medium.com/ keeps in mind that dish could consist of greater focus of healthy protein.

#196453
Aug 31, 2018 8:56
Vote:
 

We have this problem as well. If the shortcut points to a media file the same exception occurs. I believe it is the following code which throws the exception in the IsVisibleOnSite method:

      if (pageData.TryGetShortcut(instance, out shortcut))
        pageData = (PageData) shortcut;
EPiServer.CMS.AspNet.11.20.5
#251165
Mar 23, 2021 12:46
* 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.