umbraco-doc-type-grid-editor icon indicating copy to clipboard operation
umbraco-doc-type-grid-editor copied to clipboard

Issue with DTGE and (Umbraco.MediaPicker3) image not being selected

Open jacklawry opened this issue 4 years ago • 2 comments

I have a (test) really simple view for this grid block:

@inherits UmbracoViewPage<IPublishedElement>
@using Umbraco.Web.Models
@{
    var image = Model.Value<MediaWithCrops>("image");
}
<p>TEST</p>

If the image is not selected then it throws an error? if it is selected then it shows TEST as expected…

Umbraco v8.14.1

jacklawry avatar Sep 23 '21 09:09 jacklawry

What error do you get?

skttl avatar Sep 23 '21 09:09 skttl

System.NullReferenceException: Object reference not set to an instance of an object. at Umbraco.Web.PropertyEditors.ValueConverters.MediaPickerWithCropsValueConverter.ConvertIntermediateToObject(IPublishedElement owner, IPublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) in D:\a\1\s\src\Umbraco.Web\PropertyEditors\ValueConverters\MediaPickerWithCropsValueConverter.cs:line 60 at Umbraco.Core.Models.PublishedContent.PublishedPropertyType.ConvertInterToObject(IPublishedElement owner, PropertyCacheLevel referenceCacheLevel, Object inter, Boolean preview) in D:\a\1\s\src\Umbraco.Core\Models\PublishedContent\PublishedPropertyType.cs:line 219 at Our.Umbraco.DocTypeGridEditor.Models.DetachedPublishedProperty.<.ctor>b__7_1() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at Our.Umbraco.DocTypeGridEditor.Models.DetachedPublishedProperty.GetValue(String culture, String segment) at Umbraco.Web.PublishedPropertyExtension.Value[T](IPublishedProperty property, String culture, String segment, Fallback fallback, T defaultValue) in D:\a\1\s\src\Umbraco.Web\PublishedPropertyExtension.cs:line 55 at Umbraco.Web.PublishedElementExtensions.Value[T](IPublishedElement content, String alias, String culture, String segment, Fallback fallback, T defaultValue) in D:\a\1\s\src\Umbraco.Web\PublishedElementExtensions.cs:line 144 at ASP._Page_Views_Partials_dTGEPromoPanel_cshtml.Execute() in C:\GIT\Client\siteNameFolder\SiteName\Views\Partials\dTGEPromoPanel.cshtml:line 4 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:line 25 at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at Our.Umbraco.DocTypeGridEditor.Web.Extensions.HtmlHelperExtensions.RenderDocTypeGridEditorItem(HtmlHelper helper, IPublishedElement content, String editorAlias, String viewPath, String previewViewPath, Boolean isPreview) at ASP._Page_App_Plugins_DocTypeGridEditor_Render_DocTypeGridEditor_cshtml.Execute() in C:\GIT\Client\siteNameFolder\SiteName\App_Plugins\DocTypeGridEditor\Render\DocTypeGridEditor.cshtml:line 28 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:line 25 at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) at ASP._Page_Views_Partials_grid_editors_Base_cshtml.Execute() in C:\GIT\Client\siteNameFolder\SiteName\Views\Partials\grid\editors\Base.cshtml:line 20

jacklawry avatar Sep 23 '21 09:09 jacklawry