Error in MvcSiteMapNode.cs when trying to create dynamic nodes

Jul 12, 2011 at 3:09 PM

I'm trying to integrate my current project with another one and maintain my sitemap structure so that I can use a breadcrumb trail throughout the site. The details in my previous discussion (http://mvcsitemap.codeplex.com/discussions/262232) still hold true, except that now the nodes in the sitemap contain an "area" attribute. The dynamic nodes worked fine until I tried to integrate these projects. The only difference I can see so far is that now the dynamic nodes are in a specific area. I haven't defined any nodes for the other project at all, only used the ones I already had working before. I have my sitemap file in the root of the project, and the dynamic node providers in the specific area (but I have moved the providers to the root as well and the problem persists).

Here is the stack trace for the error:

Value cannot be null.
Parameter name: type

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.ArgumentNullException: Value cannot be null.
Parameter name: type

Source Error: 

Line 154:                    if (dynamicNodeProvider == null)
Line 155:                    {
Line 156:                        dynamicNodeProvider = Activator.CreateInstance(
Line 157:                            Type.GetType(this["dynamicNodeProvider"])) as IDynamicNodeProvider;
Line 158:                    }


Source File: C:\Users\[removed]...\Library\MvcSiteMapProvider\MvcSiteMapNode.cs    Line: 156 

Stack Trace: 

[ArgumentNullException: Value cannot be null.
Parameter name: type]
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +9635174
   System.Activator.CreateInstance(Type type) +6
   MvcSiteMapProvider.MvcSiteMapNode.get_DynamicNodeProvider() in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\MvcSiteMapNode.cs:156
   MvcSiteMapProvider.DefaultSiteMapProvider.HasDynamicNodes(SiteMapNode node) in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:1039
   MvcSiteMapProvider.DefaultSiteMapProvider.ProcessXmlNodes(SiteMapNode rootNode, XElement rootElement) in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:700
   MvcSiteMapProvider.DefaultSiteMapProvider.BuildSiteMap() in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:538

[MvcSiteMapException: An error occured while building the sitemap... Check the InnerException for more details.]
   MvcSiteMapProvider.DefaultSiteMapProvider.BuildSiteMap() in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:613
   System.Web.StaticSiteMapProvider.FindSiteMapNode(String rawUrl) +120
   MvcSiteMapProvider.DefaultSiteMapProvider.FindSiteMapNode(HttpContext context, RouteData routeData) in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:1106
   MvcSiteMapProvider.DefaultSiteMapProvider.FindSiteMapNode(HttpContext context) in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:1068
   System.Web.SiteMapProvider.get_CurrentNode() +56
   MvcSiteMapProvider.DefaultSiteMapProvider.get_CurrentNode() in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\DefaultSiteMapProvider.cs:116
   MvcSiteMapProvider.Web.Html.SiteMapPathHelper.SiteMapPath(MvcSiteMapHtmlHelper helper, String templateName) in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\Web\Html\SiteMapPathHelper.cs:44
   MvcSiteMapProvider.Web.Html.SiteMapPathHelper.SiteMapPath(MvcSiteMapHtmlHelper helper) in C:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Library\MvcSiteMapProvider\Web\Html\SiteMapPathHelper.cs:33
   ASP._Page_Areas_Advancement_Views_Shared__Layout_cshtml.Execute() in c:\Users\bxr3\Documents\Visual Studio 2010\Projects\TFS\Datatel WebUI\Datatel.Web.UI\Areas\Advancement\Views\Shared\_Layout.cshtml:53
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +207
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +81
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88
   System.Web.WebPages.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer) +102
   System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +12
   System.Web.WebPages.WebPageBase.Write(HelperResult result) +67
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +66
   System.Web.WebPages.WebPageBase.PopContext() +262
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +220
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +303
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
   System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +19
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343
   System.Web.Mvc.Controller.ExecuteCore() +116
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8920029
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.225

 

Please let me know if you need any more info.

Thanks

Coordinator
Jul 25, 2011 at 10:05 AM

It looks like either dynamicNodeProvider is not set on the node -or- the type specified there can not be resolved.