Wednesday, 27 March 2013

4.11.3 - Of Razor, Mvc, and More

I have started testing Razor and Mvc features. Here are the important bits:

  • XPathNodeIterator MoveNext issues revisited:
    if (media != null && media.Current != null)

    Does not work in mono, as until MoveNext() is called Current is always null.

  • 'Could not locate Razor Host Factory type: umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines' error message - this stems from a bug in mono. The quick resolution is to use either one of the two below:

    In web.config use:
    <host factoryType="umbraco.MacroEngines.RazorUmbracoFactory" />

    or use
    <host factoryType="umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines, Version=1.0.4832.22841, Culture=neutral, PublicKeyToken=null" />

    The 'bug' is in the mono type enumerator:

    In mono System.Web.Compilation > BuildManager > public static Type GetType (string typeName, bool throwOnError, bool ignoreCase)

    var aname = new AssemblyName (typeName.Substring (comma + 1));
    wantedAsmName = aname.ToString ();
    if (String.Compare (wantedAsmName, asm.GetName ().ToString (), StringComparison.Ordinal) == 0) {

    Looks for an exact match in assembly name if one is supplied

  • Some razor logic seems to produce a compiler error:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    var level = String.IsNullOrEmpty(Parameter.Level) ? 1 : int.Parse(Parameter.Level);
    var ulClass = String.IsNullOrEmpty(Parameter.UlClass) ? "" : String.Format(" class=\"{0}\"", Parameter.UlClass);
    var parent = @Model.AncestorOrSelf(level);
    if (parent != null) { ** fails here **

    Produces 'single file build failed,' and this can be traced back to a lock in the mono System.Web.Compilation > BuildManager.cs > static void Build (VirtualPath vp) > line 404.

    static readonly object bigCompilationLock = new object ();
    CompilationSection cs = CompilationConfig;
    lock (bigCompilationLock) {

    This is the most serious error so far, and needs some investigation. However, in this case, removing the null check is sufficient to make the compilation succeed, and workarounds therefore, may exist.

  • Summary 1: in addition to casing issues, the XPathNodeIterator MoveNext issue is emerging as a key issue.

  • Summary 2: Razor and MVC functionality will need further testing.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.