Copied to clipboard

Flag this post as spam?

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


  • Chad 65 posts 129 karma points c-trib
    Jan 12, 2011 @ 01:10
    Chad
    0

    Cannot get Razor to work in 4.6

    I create a new Razor scripting file. Just just a test string in there (no actual razor code), then put the macro in a template and it displays:

    Error loading MacroEngine script (file: test.razor)

    Nothing else in the log table.. etc.

  • Evan Jardine 108 posts 168 karma points
    Jan 12, 2011 @ 02:16
    Evan Jardine
    0

    Hi Chad

    I'm getting the same problem.  If you look at the trace (?umbDebugShowTrace=true) the actual error message is;

    Error loading MacroEngine script (file: test.razor, Type: ''No MacroEngine found for extension ''
      at umbraco.cms.businesslogic.macro.MacroEngineFactory.GetByExtension(String extension)
      at umbraco.macro.loadMacroDLR(MacroModel macro)
      at umbraco.macro.renderMacro(MacroModel model, Hashtable pageElements, Int32 pageId)

    Only happens when using a scripting file/macro combination. If you put the code directly into a template like;

    <umbraco:Macro runat="server" language="razor">
       @Model.Name
    </umbraco:Macro>

    Everything works fine.

    Regards
    Evan

  • Chad 65 posts 129 karma points c-trib
    Jan 12, 2011 @ 02:56
    Chad
    0

    The file extension is not being passed, so it doesn't know what Macro engine to use to perform the rendering. (macro.cs line 356)

            public Control renderMacro(Hashtable attributes, Hashtable pageElements, int pageId)
            {
                MacroModel m = ConvertToMacroModel(attributes);
                return renderMacro(m, pageElements, pageId);
            }

    ConvertToMacroModel method does not set the 'ScriptLanguage' property, there is then (marco.cs - line 1059):

    IMacroEngine engine = MacroEngineFactory.GetByExtension(macro.ScriptLanguage);

    ScriptLanguage property is null - so the system doesn't know what Macro engine to use.

    I'd throw up a patch but this is my first dabble with the source, I've no idea what I might break!

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jan 12, 2011 @ 03:29
    Aaron Powell
    0

    Can either of you log it as a bug on codeplex please

  • Evan Jardine 108 posts 168 karma points
    Jan 12, 2011 @ 03:57
  • Chad 65 posts 129 karma points c-trib
    Jan 12, 2011 @ 04:12
    Chad
    0

    In ConvertToMacroModel I've thrown a quick check in place to see if it's null and if we can derive it from the ScriptFile:

    if (string.IsNullOrEmpty(model.ScriptLanguage) && !string.IsNullOrEmpty(this.ScriptFile)) {
                        model.ScriptLanguage = Path.GetExtension(this.ScriptFile).Substring(1);
                }

     

  • Chad 65 posts 129 karma points c-trib
    Jan 12, 2011 @ 04:20
    Chad
    0

    Argh, editing seems broken.

    Anyway, the resulting .dll is 50k smaller than the one in the release build, it also throws a warning Master template is the same as the current template. It would course an endless loop! it seems the release build is different than the source it is tagged with on codeplex?

  • Chad 65 posts 129 karma points c-trib
    Jan 12, 2011 @ 07:49
    Chad
    0

    Nevermind, found the extra 50k, the umbraco.dll in the 4.6 download has been compiled in debug mode :/

     

     

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Jan 12, 2011 @ 13:50
    Niels Hartvig
    1

    We believe we've fixed all the bugs reported since the release. Could you help us test with this nightly build: http://bit.ly/gtoyV1

  • sun 403 posts 395 karma points
    Jan 12, 2011 @ 14:19
    sun
    0

    wow, thanks for your work. 4.6.* must be a very stable and classic version.

  • Evan Jardine 108 posts 168 karma points
    Jan 12, 2011 @ 23:54
    Evan Jardine
    0

    Confirmed now working fine

Please Sign in or register to post replies

Write your reply to:

Draft