Root node cannot be null

Apr 20, 2010 at 3:06 PM

I'm getting this error occasionally on a new site I'm building.

Root node defined in provider MvcSiteMap is null, root node cannot be null

Any ideas what I'm doing wrong?

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-1.0" enableLocalization="false">
  <mvcSiteMapNode title="Menu" controller="Home" action="Index" isDynamic="true" dynamicParameters="*">
    <mvcSiteMapNode title="Control Panel" controller="Home" action="ControlPanel" />

    <mvcSiteMapNode title="Accounts" controller="Account" action="Index">
      <mvcSiteMapNode title="Login" controller="Account" action="LogOn" />
      <mvcSiteMapNode title="Register Account" controller="Account" action="Register" />
      <mvcSiteMapNode title="Change Password" controller="Account" action="ChangePassword" />
      <mvcSiteMapNode title="My STEP" controller="Account" action="Home" />
      <mvcSiteMapNode title="Edit Profile" controller="Account" action="EditProfile"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Edit SATERN Id" controller="Account" action="EditSaternId"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Edit Supervisor" controller="Account" action="EditSupervisor"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Logout" controller="Account" action="LogOff" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Courses" controller="Course" action="Index">
      <mvcSiteMapNode title="Edit Course" controller="Course" action="Edit"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Create Course" controller="Course" action="Create" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Disciplines" controller="Discipline" action="Index">
      <mvcSiteMapNode title="Edit Discipline" controller="Discipline" action="Edit"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Edit Discipline Courses" controller="Discipline" action="EditCourses"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Create Discipline" controller="Discipline" action="Create" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Equivalencies" controller="Equivalency" action="Index">
      <mvcSiteMapNode title="Edit Equivalency" controller="Equivalency" action="Edit"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Create Equivalency" controller="Equivalency" action="Create" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Organizations" controller="Organization" action="Index">
      <mvcSiteMapNode title="Edit Organization" controller="Organization" action="Edit"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Create Organization" controller="Organization" action="Create" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Requests" controller="Request" action="Index">
      <mvcSiteMapNode title="Edit Request" controller="Request" action="Edit"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Create Request" controller="Request" action="Create" />
    </mvcSiteMapNode>

    <mvcSiteMapNode title="Roles" controller="Role" action="Index">
      <mvcSiteMapNode title="Edit Role" controller="Role" action="Edit"
                      isDynamic="true" dynamicParameters="*" />
      <mvcSiteMapNode title="Create Role" controller="Role" action="Create" />
    </mvcSiteMapNode>
  </mvcSiteMapNode>
</siteMap>

Coordinator
Apr 26, 2010 at 1:58 PM

Is this during development or are you seeing this in production as well?

Apr 27, 2010 at 1:45 PM

This is in development and production (Although I don't see what the difference would be...)

I saw this mostly with the Account/Edit* actions specifically. There is nothing weird about these Actions. It appeared that I got this more often when logged in as a lower privileged user... I AM using a Custom authorization attribute on everything which doesn't have any other weird effects, and really just adds NONCE functionality to the authorization process for better security.

The site is hosted under a virtual directory, so perhaps this is related to that issue? It will be that way in production too, so that is already a major issue for me that may hold me back from including the provider in the release.

Apr 27, 2010 at 2:19 PM

This seems to have been resolved by the latest source code release. I'll shut up now.... :-)

May 24, 2010 at 2:20 PM
Edited May 24, 2010 at 2:30 PM

... and seems to be back in 46601.

Though I am only seeing it when trying to go to the root /Home/Index location.

May 26, 2010 at 5:09 PM

I've gone through and cleared my Web.sitemap file and started from scratch. This time, instead of using dynamicParameters="*" on lots of things, I tried specifying the dynamicParamters="id" or equivalent on things instead, and that seems to have removed some of the weirdness I've been seeing. I don't know if this is because I didn't fully understand what the * in that line did, or if it's a bug of some sort. I took it to mean "Any parameters passed"... but I would see things like the SiteMap provider choosing the first node up in the sitemap that it saw fit for various things (in the above example, it would have been ControlPanel, as its the first node without dynamic parameters, or it would have been EditProfile, the first node WITH dynamic parameters).

I have it at a working state right now for my needs, but I would still kind of like clarification as to why the dynamic parameter lines were adding so many issues so I know what they are meant to do.

/ Michael /