Copied to clipboard

Flag this post as spam?

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


  • J 150 posts 489 karma points
    Jan 17, 2012 @ 10:08
    J
    0

    Dynamic parameters not working on version 4.7.1.1

    Hi guys,

    I have the following macro:

    <umbraco:Macro Alias="CdLoader" CssPaths="Reset.css|Styles.css" runat="server" />

    And getting the CssParameter from the razor file:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @{
        // This parameters is empty 
        var cssPaths = Parameter.CssPaths;
    }
    

    This was working ok in version 4.7.1 but it seems to be broken in 4.7.1.1. Do you guys know why is this happening?

    Thanks

    Jorge

  • J 150 posts 489 karma points
    Jan 17, 2012 @ 10:23
    J
    1

    I seems that I also need to set them in the backend

    CD Macro Parameter

    Solved :)

  • James Drever 118 posts 149 karma points
    Jan 20, 2012 @ 12:18
    James Drever
    0

    Yes thanks Jorge I've just found exactly the same thing.  Perhaps ought to be documented as a breaking change?

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 24, 2012 @ 14:19
    Dan Diplo
    0

    If this is the case it really should be labeled as a breaking change since it will potentially break a lot of sites when doing a patch upgrade.

    Also, I actually found the fact that you didn't need to add parameters to macros a plus point of Razor, as it removes one tedious step and makes develoment much more instantaneous.

     

  • J 150 posts 489 karma points
    Jan 24, 2012 @ 17:01
    J
    0

    @james @dan Yes, I believe we should report it as a breaking change. Do you guys know where we can do that?

    Thanks,

    J

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 24, 2012 @ 21:04
    Dan Diplo
    0

    @Jorge You can report issues using the Issue Tracker at Codeplex - http://umbraco.codeplex.com/workitem/list/basic 

    Whilst some may claim this isn't a bug, I think it should be reported as it may or may not have been an intentional decision to change the behaviour.

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Jan 26, 2012 @ 09:43
    Niels Hartvig
    0

    It's not a bug, quite the contrary - it was a unexpected side-effect that it even worked that way before (a bug!). 

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Jan 26, 2012 @ 09:47
    Niels Hartvig
    1

    I've added it as a breaking change in the upgrading info on the Codeplex page.

  • James Drever 118 posts 149 karma points
    Jan 26, 2012 @ 09:52
    James Drever
    0

    Thanks Niels!

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 26, 2012 @ 09:53
    Dan Diplo
    0

    It may have been unintentional, but it was actually something I really liked as it may developing macros with razor much more dynamic and reactive (which is surely a good thing, no?). The only reason I can see to actually add parameters to a macro would be if it's used in the editor.

    Given there wasn't really much documentation about Razor (at least when it was first introduced) it's not suprising that people assumed this was a feature rather than an "unexpected side-effect". I know I've taken advantage of it on a number of sites, and didn't realise these would all break when doing a patch-upgrade to 4.7.1.1 - this will make it a major headache upgrading them. I think it's important if behaviour like this is changed then it is clearly listed as a "breaking change" and documented (EDIT: Which you have now done - thank you!)

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Jan 26, 2012 @ 09:58
    Niels Hartvig
    0

    @Dan: We had no idea that it would break anything as we didn't know that people worked around a bug like that (not even unit tests would catch it). There's no difference in the macro wrapper between how razor, xslt or .net controls work, so for us nothing was changed. It's just unfortunate that it's been picked up by a few as a practice and of course leading to a frustration by those who do.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jan 26, 2012 @ 10:10
    Dan Diplo
    0

    Fair enough, Neils :)  I guess in future you just need to be aware that the Umbraco community are a creative lot and if we find a way of doing something easier than we will do it :D

  • J 150 posts 489 karma points
    Jan 26, 2012 @ 10:28
    J
    0

    @niels thanks a lot

  • Keith Petersen 67 posts 111 karma points
    Jan 26, 2012 @ 23:16
    Keith Petersen
    1

    Note to anyone new to Umbraco / Razor who reads this:

    You don't have to pass document type properties of the current page as parameters. They're properties of the Model object, so you might not need any parameters or need to create a macro in the Developer section. You can call the Razor script in the template like this:

    <umbraco:Macro FileLocation="~/macroScripts/myRazorScript.cshtml" runat="server" />

Please Sign in or register to post replies

Write your reply to:

Draft