Copied to clipboard

Flag this post as spam?

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


  • Carl Lundblad 12 posts 33 karma points
    Jun 13, 2012 @ 11:21
    Carl Lundblad
    0

    HTML-comment in template, nullreference-error after upgrade

    Heya, I just stumbled upon a, to me, very peculiar thing;

    I upgraded an old 4.6.1-project to 4.7.2(by replacing files in the bin-folder and umbraco-/umbraco_client-folders). After the upgrade, my frontpage and some of the subpages ran smoothly, but all pages(/nodes) with a certain template kept giving me this:

    Object reference not set to an instance of an object

    [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
       ...

    So, something is obviously wrong with (at least) one of my macros. So I remove all the macro-tags(well, all umbraco-tags, just to be sure), but the error presists. So I try removing all HTML in the temlplate, thinking that this should not make any difference. Voila, the page runs. Huh?

    It turns out my template had these lines:

    <!--<umbraco:Item field="articleImageInter" runat="server"></umbraco:Item>
    <umbraco:Macro Alias="articleImageInter" runat="server"></umbraco:Macro>-->

    Commented out. articleImageInter is - apparently - a macro that no longer exists. In 4.6.1 it didn't matter, and the site ran fine with the lines commented out. So, removing these lines(or replacing the alias for the macro with a name of an existing macro), fixed it right up for me.

    Just thought I'd share this if someone else has these kind of issues after an upgrade. :)

    Cheers

    Carl

     

Please Sign in or register to post replies

Write your reply to:

Draft