diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeDefinitionCollection.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeDefinitionCollection.cs index 062145bbf7..58b8f9ebc1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeDefinitionCollection.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeDefinitionCollection.cs @@ -10,6 +10,7 @@ using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Collections.Generic; using Umbraco.Core; +using Umbraco.Core.Logging; using Umbraco.Web; using umbraco.interfaces; using umbraco.BusinessLogic.Utils; @@ -170,20 +171,27 @@ namespace umbraco.cms.presentation.Trees //The logic of this has changed in 6.0: http://issues.umbraco.org/issue/U4-1360 // we will support the old legacy way but the normal way is to match on assembly qualified names - var appTreesForType = appTrees.FindAll( - tree => - { - //match the type on assembly qualified name if the assembly attribute is empty or if the - // tree type contains a comma (meaning it is assembly qualified) - if (tree.AssemblyName.IsNullOrWhiteSpace() || tree.Type.Contains(",")) - { - return tree.Type == type.GetFullNameWithAssembly(); - } + var appTreesForType = appTrees.FindAll( + tree => + { + //match the type on assembly qualified name if the assembly attribute is empty or if the + // tree type contains a comma (meaning it is assembly qualified) + if (tree.AssemblyName.IsNullOrWhiteSpace() || tree.Type.Contains(",")) + { + var clrType = Type.GetType(tree.Type); + if (clrType == null) + { + LogHelper.Warn("The tree definition: " + tree.Type + " could not be resolved to a .Net object type"); + return false; + } - //otherwise match using legacy match rules - return (string.Format("{0}.{1}", tree.AssemblyName, tree.Type).InvariantEquals(type.FullName)); - } - ); + return clrType == type; + } + + //otherwise match using legacy match rules + return (string.Format("{0}.{1}", tree.AssemblyName, tree.Type).InvariantEquals(type.FullName)); + } + ); foreach (var appTree in appTreesForType) {