Umbraco Upgrade 7.3.8 to 7.7.13 "Error parsing XSLT file"
Hello! I'm back with another Umbraco upgrade issue in my journey from 7.2.8 to 7.12.2. Today I'm working on going from 7.3.8 to 7.7.13, but running into a snag where our (old) XSLT macros are not rendering on the masterpage.
2018-09-17 12:43:36,430 [11] WARN umbraco.macro - Error parsing XSLT file. Exception: System.TypeLoadException: Could not load type 'umbraco.presentation.umbracobase.RestExtension' from assembly 'umbraco, Version=1.0.6628.38731, Culture=neutral, PublicKeyToken=null'.
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
at Umbraco.Core.TypeFinder.<>c__DisplayClass23_0.<GetClassesWithAttribute>b__0(Type x)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Umbraco.Core.TypeFinder.GetClassesWithAttribute(Type attributeType, IEnumerable`1 assemblies, Boolean onlyConcreteClasses)
at Umbraco.Core.TypeFinder.FindClassesWithAttribute[T](IEnumerable`1 assemblies, Boolean onlyConcreteClasses)
at Umbraco.Core.TypeFinder.FindClassesWithAttribute[T](IEnumerable`1 assemblies)
at Umbraco.Core.PluginManager.<>c__DisplayClass53_0`1.<ResolveAttributedTypes>b__0()
at Umbraco.Core.PluginManager.ResolveTypesInternalLocked(Type baseType, Type attributeType, Func`1 finder, Boolean cache)
at Umbraco.Core.PluginManager.ResolveTypesInternal(Type baseType, Type attributeType, Func`1 finder, Boolean cache)
at Umbraco.Core.PluginManager.ResolveAttributedTypes[TAttribute](Boolean cache, IEnumerable`1 specificAssemblies)
at Umbraco.Web.WebBootManager.<InitializeResolvers>b__17_1()
at Umbraco.Core.ObjectResolution.LazyManyObjectsResolverBase`2.<>c.<Initialize>b__17_2(Func`1 x)
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Umbraco.Core.ObjectResolution.LazyManyObjectsResolverBase`2.<Initialize>b__17_0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Umbraco.Core.ObjectResolution.LazyManyObjectsResolverBase`2.get_InstanceTypes()
at Umbraco.Core.Macros.XsltExtensionsResolver.CreateInstances()
at Umbraco.Core.ObjectResolution.ManyObjectsResolverBase`2.<InitializeAppInstances>b__14_0()
at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Lazy`1.get_Value()
at Umbraco.Core.ObjectResolution.ManyObjectsResolverBase`2.get_Values()
at umbraco.macro.GetXsltExtensions()
at umbraco.macro.AddMacroXsltExtensions()
at umbraco.macro.GetXsltTransformResult(XmlDocument macroXml, XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.LoadMacroXslt(macro macro, MacroModel model, Hashtable pageElements, Boolean throwError)
Any ideas how to solve this? Does 7.7.13 (and up to 7.12.2) still support XSLT macros?
Also: I did see this note on the upgrade guide, would this be the culprit?
Version 7.7.2 no longer ships with the CookComputing.XmlRpcV2 assembly
so if you reference this assembly or have a package that requires this
assembly, you may need to copy it back into your website from the
backup you've taken before you began the 7.7.2 upgrade.
via: https://our.umbraco.com/documentation/getting-started/setup/upgrading/version-specific
I suspect it's some sort of old DLL problem but I've build-->clean --> build and also removed old stuff floating around in there such as uGoLive (per here: https://issues.umbraco.org/issue/U4-5220 ) but no luck.
You definitely shouldn't change the definition of an existing namespace like umbraco.library. Instead, define another and use that prefix where you need to call those specific methods.
But I don't think you can "just" add UmbracoHelper - it needs to be "prepped" somehow for adding as an extension to use from XSLT (e.g. I'm pretty sure it needs to be a static class with static methods - but I'm in no way qualified for anything complicated C#-wise, so... :-)
I'll need to read up on your original problem before I can give any real help though, so I'll just do that and return...
But I'm pretty sure it's all the references that UmbracoHelper has itself that are problematic...
To "fix" that, you could create your own helper library and create a MemberIsLoggedOn() method inside of that, something like this:
// Misc. using statements...
namespace chris {
[XsltExtension("chris.helpers")]
public class Helpers {
public Helpers() {}
// This could be called from XSLT with `chris.helpers:MemberIsLoggedOn()`
private static bool MemberIsLoggedOn() {
return true; // Needs more garlic here, obviously :)
}
}
}
You can just put that in the App_Code/ folder to quickly try it out...
Thank you for your help! No doubt that looks like it'd work; I just spent a bit today and refactored my tiny chunk of xslt I needed into a macro script as it seemed easier that way.
I think the issue is something underlying with a dll or something within my project. I have a larger xslt file and it's got the same problem without any references to UmbracoHelper.
I did try your namespace fix above and got the same error (with the 'weather' xslt file I have):
2018-09-24 15:11:11,537 [14] WARN umbraco.macro - Error parsing XSLT file. Exception: System.TypeLoadException: Could not load type 'umbraco.cms.businesslogic.datatype.ClientDependencyAttribute' from assembly 'cms, Version=1.0.6628.38729, Culture=neutral, PublicKeyToken=null'.
at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
at Umbraco.Core.TypeFinder.<>c__DisplayClass23_0.<GetClassesWithAttribute>b__0(Type x)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Umbraco.Core.TypeFinder.GetClassesWithAttribute(Type attributeType, IEnumerable`1 assemblies, Boolean onlyConcreteClasses)
at Umbraco.Core.TypeFinder.FindClassesWithAttribute[T](IEnumerable`1 assemblies, Boolean onlyConcreteClasses)
at Umbraco.Core.TypeFinder.FindClassesWithAttribute[T](IEnumerable`1 assemblies)
at Umbraco.Core.PluginManager.<>c__DisplayClass53_0`1.<ResolveAttributedTypes>b__0()
at Umbraco.Core.PluginManager.ResolveTypesInternalLocked(Type baseType, Type attributeType, Func`1 finder, Boolean cache)
at Umbraco.Core.PluginManager.ResolveTypesInternal(Type baseType, Type attributeType, Func`1 finder, Boolean cache)
at Umbraco.Core.PluginManager.ResolveAttributedTypes[TAttribute](Boolean cache, IEnumerable`1 specificAssemblies)
at Umbraco.Web.WebBootManager.<InitializeResolvers>b__17_1()
at Umbraco.Core.ObjectResolution.LazyManyObjectsResolverBase`2.<>c.<Initialize>b__17_2(Func`1 x)
at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at Umbraco.Core.ObjectResolution.LazyManyObjectsResolverBase`2.<Initialize>b__17_0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Umbraco.Core.ObjectResolution.LazyManyObjectsResolverBase`2.get_InstanceTypes()
at Umbraco.Core.Macros.XsltExtensionsResolver.CreateInstances()
at Umbraco.Core.ObjectResolution.ManyObjectsResolverBase`2.<InitializeAppInstances>b__14_0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Umbraco.Core.ObjectResolution.ManyObjectsResolverBase`2.get_Values()
at umbraco.macro.GetXsltExtensions()
at umbraco.macro.AddMacroXsltExtensions()
at umbraco.macro.GetXsltTransformResult(XmlDocument macroXml, XslCompiledTransform xslt, Dictionary`2 parameters)
at umbraco.macro.LoadMacroXslt(macro macro, MacroModel model, Hashtable pageElements, Boolean throwError)
Umbraco Upgrade 7.3.8 to 7.7.13 "Error parsing XSLT file"
Hello! I'm back with another Umbraco upgrade issue in my journey from 7.2.8 to 7.12.2. Today I'm working on going from 7.3.8 to 7.7.13, but running into a snag where our (old) XSLT macros are not rendering on the masterpage.
Any ideas how to solve this? Does 7.7.13 (and up to 7.12.2) still support XSLT macros?
Also: I did see this note on the upgrade guide, would this be the culprit?
Best,
Chris
Some gracious folks have helped move the ball forward on twitter: https://twitter.com/chrisvanoort/status/1041746393029910528
Per their recommendations, I changed the reference in XSLT but have a new runtime exception. Any ideas?
I changed umbraco.library to Umbraco.Web.BaseRest I also tried changing umbraco.library to Umbraco.Web.UmbracoHelpers (I think this is correct as it's shown in API docs https://our.umbraco.com/apidocs/csharp/api/Umbraco.Web.UmbracoHelper.html?q=MemberIslogg) Then I changed IsLoggedOn() to MemberIsLoggedOn()
One of the XSLT files I'm trying to get working (really simple one):
The new exception I'm getting:
I suspect it's some sort of old DLL problem but I've build-->clean --> build and also removed old stuff floating around in there such as uGoLive (per here: https://issues.umbraco.org/issue/U4-5220 ) but no luck.
Hi Chris,
You definitely shouldn't change the definition of an existing namespace like
umbraco.library
. Instead, define another and use that prefix where you need to call those specific methods.But I don't think you can "just" add UmbracoHelper - it needs to be "prepped" somehow for adding as an extension to use from XSLT (e.g. I'm pretty sure it needs to be a static class with static methods - but I'm in no way qualified for anything complicated C#-wise, so... :-)
I'll need to read up on your original problem before I can give any real help though, so I'll just do that and return...
/Chriztian
OK, so I'd recommend you try this:
Change the stylesheet element to this simple version without all the other unnecessary namespaces:
and then change the line where you call the
MemberIsLoggedOn()
method to just bypass that, e.g.:If this works, you can go on and add the helper reference like this:
and see if it works by using it like this:
...
But I'm pretty sure it's all the references that UmbracoHelper has itself that are problematic...
To "fix" that, you could create your own helper library and create a
MemberIsLoggedOn()
method inside of that, something like this:// Misc. using statements...
You can just put that in the App_Code/ folder to quickly try it out...
/Chriztian
Hi Chriztian,
Thank you for your help! No doubt that looks like it'd work; I just spent a bit today and refactored my tiny chunk of xslt I needed into a macro script as it seemed easier that way.
I think the issue is something underlying with a dll or something within my project. I have a larger xslt file and it's got the same problem without any references to UmbracoHelper.
I did try your namespace fix above and got the same error (with the 'weather' xslt file I have):
Weather xslt file:
is working on a reply...