I have a Dynamic Module that has a related image field. Once the dynamic content item is published, if someone has accidentally locked the related image in the Image Library (usually using the back button) whenever I try to get the image to get the url for the widget I get a System.Reflection.TargetInvocationException.
public static string GetRelatedImageLink(this DynamicContent dynamicContent, string fieldName)
Image image = dynamicContent.GetRelatedItems<
if (image != null)
Does anyone have a better way to get the related images url? I would it rather just not get the url and not show anything that throw a controller error that hoses the entire widget in stead of not displaying the image.