Incorrect Current Node with DynamicNodeProvider

Apr 1, 2011 at 7:39 PM

I have the following mvc.sitemap file defined using MvcSiteMapProvider v3.0:

<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-3.0" enableLocalization="true">
    <mvcSiteMapNode title="Codename Seamless" clickable="false" controller="Home">
        <mvcSiteMapNode title="Reports" controller="Reports" action="Index" changeFrequency="Always" updatePriority="Normal">
            <mvcSiteMapNode title="All Reports" action="AllReports" changeFrequency="Always" updatePriority="Normal" />
            <mvcSiteMapNode title="" clickable="false" action="ViewReport" changeFrequency="Always" updatePriority="Normal" />
            <mvcSiteMapNode title="ReportsByCategory" action="ReportsByCategory" dynamicNodeProvider="AAC.Web.Navigation.ReportsDynamicNodeProvider, AffiliatedSecure" />
        </mvcSiteMapNode>
    </mvcSiteMapNode>
</mvcSiteMap>


And I have the following DynamicNodeProviderBase descendant used to generate dynamic nodes:

public class ReportsDynamicNodeProvider : DynamicNodeProviderBase, IReportsNodeProvider
{
    public ReportsDynamicNodeProvider(): this(null)
    {
    }
    
    public ReportsDynamicNodeProvider(Services.Reports.IReportService reportService)
    {
        ReportService = reportService ?? new Services.Reports.DefaultReportService();
    }
    public Services.Reports.IReportService ReportService { get; protected set; }
    public override IEnumerable<DynamicNode> GetDynamicNodeCollection()
    {
        var categories = from r in ReportService.GetAvailableReports()
                         select r.Category;
        foreach (string category in categories.Distinct())
        {
            DynamicNode node = new DynamicNode()
            {
                Title = category
            };
            node.RouteValues.Add("categoryName", category);
            yield return node;
        }
    }
}

The dynamic nodes are generated from the sitemap and their routes function properly when they are displayed.
The problem is that when any dynamic node in this scenario is clicked in the UI, the first one in the collection returned from GetDynamicNodeCollection is set as the current node at the SiteMapProvider level. 
Is there something I'm missing here that could be causing this behavior?