Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Hardy Wang 91 posts 112 karma points
    Nov 28, 2012 @ 03:32
    Hardy Wang
    0

    Inline Razor Stopped Working in 4.11.0?

    I have a fresh installation of 4.11.0, and I created a test master page like

    <%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>

    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head></head>
    <body>
    <umbraco:Item field="content" runat="server" />
    <br />
    <umbraco:Macro ID="Macro1" runat="server" Language="cshtml">
    @System.Threading.Thread.CurrentThread.CurrentCulture.Name
    </umbraco:Macro>
    </body>
    </html>
    </asp:Content>

    Here I have a piece of inline Razor script. It works well in 4.9.0. But when I load a page with this master template I got an error message

    Error loading MacroEngine script (file: )

    Any clue is it a broken change?

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 28, 2012 @ 05:18
    Fuji Kusaka
    0

    Hardy seems like you are actually calling a macros with ID= "Macro1", can you try this instead assuming you are making use of inline razor in templates

     <umbraco:Macro runat="server" language="cshtml">   
    @System.Threading.Thread.CurrentThread.CurrentCulture.Name   
     </umbraco:Macro> 

    //fuji

     

  • Stephen Davidson 216 posts 392 karma points
    Nov 28, 2012 @ 12:43
    Stephen Davidson
    0

    Can we see the Macro? I know there has been a change in the way you access the properties on your page...

    @Html.Raw(Model.Content.GetPropertyValue("bodyText"))

    has become 

    @Html.Raw(Model.Content.GetPropertyValue<string>("bodyText"))

    Regards,

    S

  • Hardy Wang 91 posts 112 karma points
    Nov 28, 2012 @ 14:16
    Hardy Wang
    0

    Fuji -- I tried, with or without the ID=..." I got same error, however it works in 4.9.0 well.

    Stephen -- My macro is just one line of code as you have seen in the post, the error is not caused by <umbraco:Item field="content" runat="server" />, I removed it and got same error.

  • James Lau 37 posts 58 karma points
    Nov 29, 2012 @ 03:24
    James Lau
    0

    Have you change umbracoSettings.config?

     <scriptFileTypes>js,xml,cshtml</scriptFileTypes>
  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Nov 29, 2012 @ 07:10
    Nathan Woulfe
    0

    Fuji - you're confusing ID with Alias.

    James - I don't have cshtml included in that key and inline razor works fine.

    Hardy - strange. I've just tried your exact code and it works perfectly. Must be something else going on in your environment. Definitely isn't a breaking change from the upgrade, at least not around inline razor, as far as I can see.

  • Fuji Kusaka 2203 posts 4220 karma points
    Nov 29, 2012 @ 07:17
    Fuji Kusaka
    0

    Mine as well is working just fine. 

  • Tom 713 posts 954 karma points
    Nov 29, 2012 @ 16:13
    Tom
    0

    Just ran in to the GetPropertyValue issue. Just wondering for future reference WHERE are breaking changes like this documented.

    It's pretty major to release what's called a small patch that then blows up nearly all your razor views and macros..

    I'd like to know for future reference so i can keep up with what's going on rather than hunting on the forum to find what may/may not have changed..

     

    Cheers

    Tom

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies