We have moved to GitHub Issues
Created by Jeavon Leopold 21 Nov 2013, 08:46:48 Updated by Shannon Deminick 10 Dec 2013, 02:01:14
Is duplicated by: U4-3825
Depends on: U4-3820
If you try to use Umbraco.TypedMedia(1234) assuming 1234 doesn't exist you get an exception, the same thing happens if you pass a array of id's and one has been deleted.
[ArgumentNullException: Value cannot be null.
Parameter name: propertyType]
Umbraco.Core.Models.PublishedContent.PublishedPropertyBase..ctor(PublishedPropertyType propertyType) in f:\TeamCity\buildAgent\work\e1a0ddf7a1349eaf\src\Umbraco.Core\Models\PublishedContent\PublishedPropertyBase.cs:16
Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty..ctor(PublishedPropertyType propertyType, Boolean isPreviewing) +85
Umbraco.Web.PublishedCache.XmlPublishedCache.XmlPublishedProperty..ctor(PublishedPropertyType propertyType, Boolean isPreviewing, String propertyData) +49
2 valueDictionary, Func2 getParent, Func
2 getChildren, Func3 getProperty, Boolean fromExamine) +4842
Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache.ConvertFromXPathNavigator(XPathNavigator xpath) +1555
Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache.GetUmbracoMedia(Int32 id) +647
Umbraco.Web.PublishedCache.XmlPublishedCache.PublishedMediaCache.GetById(UmbracoContext umbracoContext, Boolean preview, Int32 nodeId) +42
Umbraco.Web.PublishedCache.ContextualPublishedCache`1.GetById(Boolean preview, Int32 contentId) +74
Umbraco.Web.PublishedCache.ContextualPublishedCache.GetById(Int32 contentId) +72
Umbraco.Web.PublishedContentQuery.TypedDocumentById(Int32 id, ContextualPublishedCache cache) +49
Umbraco.Web.PublishedContentQuery.TypedMedia(Int32 id) +47
Umbraco.Web.UmbracoHelper.TypedMedia(Int32 id) +58
Interestingly Umbraco.Content doesn't return deleted nodes at all and Umbraco.TypedContent returns null objects for each deleted node, I think Media and TypedMedia should do the same?
Is this just a v7 issue?
What is the expected result here - no exception, return null if not exist, or when passing an array of IDs don't include the item if not there?
I've not tried it on v6 but it probably exists there also, the new v7 multiple media item picker prompted the discovery of the issue.
Yep, I would except same result as you get with TypedContent and Content, don't include deleted items for Umbraco.Media, return null for deleted items for Umbraco.TypedMedia.
Can this be resolved for v7.0.1?
Hrm, I think this might be a bigger issue unfortunately. When the media item is deleted it no longer exists in Examine so the TypedMedia will revert to looking into the legacy xslt library media cache. The exception is thrown because we are not ignoring the isDoc attribute - so that's an easy fix. However, the problem still lies in the fact that the item is still being found in the media cache which it shouldn't be. Will report back shortly.
Yup so this is a bigger issue - the media xml is not removed from the cmsContentXml table when recycling media items so it still gets loaded with TypedMedia.
Assignee: Shannon Deminick
Backwards Compatible: True
Affected versions: 6.0.0, 7.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.6, 6.0.5, 6.0.7
Due in version: 6.2.0, 7.0.1