Copied to clipboard

Flag this post as spam?

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


  • Michael Nielsen 82 posts 361 karma points
    Jun 18, 2012 @ 15:33
    Michael Nielsen
    0

    umbraco:macro tag causes error

    When I add

    <umbraco:Macro runat="server" language="cshtml">

    </umbraco:Macro>

    to a template, I get this error, as soon as I remove it, everything is fine.

     

    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
       umbraco.cms.businesslogic.macro.MacroModel..ctor(Macro m) +21
       umbraco.macro..ctor(String alias) +344
       umbraco.presentation.templateControls.Macro.CreateChildControls() +1319
       System.Web.UI.Control.EnsureChildControls() +181
       System.Web.UI.Control.InitRecursive(Control namingContainer) +132
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1969
    

     

  • RGoodSW 5 posts 25 karma points
    Jun 26, 2012 @ 02:52
    RGoodSW
    0

    I believe it's because there's nothing inside the Macro tags.  This works:

    <umbraco:Macro  runat="server" language="cshtml">
    @{ var foo="bar"; }
    </umbraco:Macro>

    or this

    <umbraco:Macro  runat="server" language="cshtml">
    @{ }
    </umbraco:Macro> 
  • Michael Nielsen 82 posts 361 karma points
    Jun 27, 2012 @ 17:37
    Michael Nielsen
    0

    Ah... That was simple... Thanks...

     

Please Sign in or register to post replies

Write your reply to:

Draft