I've just upgraded my Umbraco instance from 6.0.0 to 6.0.1 and notice that some of my Razor scripts are not working anymore. This piece of code, which worked fine prior to the upgrade, now doesn't work:
@inherits umbraco.MacroEngines.DynamicNodeContext @using umbraco.MacroEngines; @using uComponents.DataTypes.UrlPicker.Dto; @using umbraco.NodeFactory; @{ if (Model.HasValue("homepageFeaturesToDisplay")) { <ul id="homePageFeatures"> @foreach (var features in Model.homepageFeaturesToDisplay) { // do stuff here } </ul> } }
It fails with the following error:
Error Loading Razor Script (file: Show Home Page Features) Cannot implicitly convert type 'umbraco.MacroEngines.PropertyResult' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at ASP._Page_macroScripts_ShowHomePageFeatures_cshtml.Execute() in c:\Users\HeJJones\documents\web team\websites\umbraco_websites\st catherines walk\umbraco_stcatherineswalk\macroScripts\ShowHomePageFeatures.cshtml:line 10 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage)
Has anything changed in the upgrade that would cause this? One thing I have noticed (i think) is that "Model.homepageFeaturesToDisplay" is returning a String value and not umbraco.MacroEngines.DynamicXml as seemed to be the case in v6.0.0. I have looked at this documentation, and my code seems to follow the process I should be coding but it's not working since the upgrade.
Is this a bug in 6.0.1 or is there an new way I should be coding this functionality? What is the "correct" way of coding it?
I've had the same problem too going from 4.11.4 to 4.11.5.
I had to change my code to Model.GetProperty("modules").Value which returned uComponents multinodetree property XML (as a string). Then I dumped it into an XMLDocument and iterated through it. This came as a bit of a surprise and I suppose it's one of pitfalls of an API that has yet to solidify.
An example below for you....
string nodes = Model.GetProperty("modules").Value;
if (nodes != string.Empty)
{
XmlDocument xd = newXmlDocument();
xd.LoadXml(nodes);
foreach (XmlElement value in xd.SelectNodes("/MultiNodePicker/nodeId"))
{ ...
Thanks for your help guys, managed to download and apply v6.0.3 as discussed here http://issues.umbraco.org/issue/U4-1824 which resolved my issues without changing any of my original code ... RESULT!!
Yep turned out to be a bug, so I download umbraco.MacroEngines.dll for 4.11.6 and replaced the buggy one and I could revert back to my original code...what a pain! lol.
6.0.1 - Loop through Multi-Node Tree Picker
Hello!
I've just upgraded my Umbraco instance from 6.0.0 to 6.0.1 and notice that some of my Razor scripts are not working anymore. This piece of code, which worked fine prior to the upgrade, now doesn't work:
It fails with the following error:
Has anything changed in the upgrade that would cause this? One thing I have noticed (i think) is that "Model.homepageFeaturesToDisplay" is returning a String value and not umbraco.MacroEngines.DynamicXml as seemed to be the case in v6.0.0. I have looked at this documentation, and my code seems to follow the process I should be coding but it's not working since the upgrade.
Is this a bug in 6.0.1 or is there an new way I should be coding this functionality? What is the "correct" way of coding it?
Thanks in advance .... Hefin
same for me in 4.11.5 update...
http://issues.umbraco.org/issue/U4-1824
Hi Hefin
I've had the same problem too going from 4.11.4 to 4.11.5.
I had to change my code to Model.GetProperty("modules").Value which returned uComponents multinodetree property XML (as a string). Then I dumped it into an XMLDocument and iterated through it. This came as a bit of a surprise and I suppose it's one of pitfalls of an API that has yet to solidify.
An example below for you....
Thanks for your help guys, managed to download and apply v6.0.3 as discussed here http://issues.umbraco.org/issue/U4-1824 which resolved my issues without changing any of my original code ... RESULT!!
Hi Hefin
Yep turned out to be a bug, so I download umbraco.MacroEngines.dll for 4.11.6 and replaced the buggy one and I could revert back to my original code...what a pain! lol.
Martin
is working on a reply...