我正在使用 MvcSiteMapProvider 为我的网站创建菜单。它工作正常,但突然失败并出现错误:
System.NullReferenceException:对象引用未设置为对象的实例。
这是堆栈跟踪:
[NullReferenceException: Object reference not set to an instance of an object.]
MvcSiteMapProvider.AuthorizeAttributeAclModule.IsAccessibleToUser(IControllerTypeResolver controllerTypeResolver, DefaultSiteMapProvider provider, HttpContext context, SiteMapNode node) in c:\Projects\Codeplex\TFS10\mvcsitemap\Branches\3.1.0\src\MvcSiteMapProvider\MvcSiteMapProvider\AuthorizeAttributeAclModule.cs:80
MvcSiteMapProvider.DefaultAclModule.IsAccessibleToUser(IControllerTypeResolver controllerTypeResolver, DefaultSiteMapProvider provider, HttpContext context, SiteMapNode node) in c:\Projects\Codeplex\TFS10\mvcsitemap\Branches\3.1.0\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultAclModule.cs:61
MvcSiteMapProvider.DefaultSiteMapProvider.IsAccessibleToUser(HttpContext context, SiteMapNode node) in c:\Projects\Codeplex\TFS10\mvcsitemap\Branches\3.1.0\src\MvcSiteMapProvider\MvcSiteMapProvider\DefaultSiteMapProvider.cs:178
System.Web.SiteMapNode.IsAccessibleToUser(HttpContext context) +17
System.Web.StaticSiteMapProvider.GetChildNodes(SiteMapNode node) +378
System.Web.SiteMapNode.get_ChildNodes() +30
System.Web.SiteMapNode.get_HasChildNodes() +10
MvcSiteMapProvider.Web.Html.MenuHelper.BuildModel(MvcSiteMapHtmlHelper helper, SiteMapNode startingNode, Boolean startingNodeInChildLevel, Boolean showStartingNode, Int32 maxDepth, Boolean drillDownToCurrent) in c:\Projects\Codeplex\TFS10\mvcsitemap\Branches\3.1.0\src\MvcSiteMapProvider\MvcSiteMapProvider\Web\Html\MenuHelper.cs:293
MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapHtmlHelper helper, String templateName, SiteMapNode startingNode, Boolean startingNodeInChildLevel, Boolean showStartingNode, Int32 maxDepth, Boolean drillDownToCurrent) in c:\Projects\Codeplex\TFS10\mvcsitemap\Branches\3.1.0\src\MvcSiteMapProvider\MvcSiteMapProvider\Web\Html\MenuHelper.cs:234
MvcSiteMapProvider.Web.Html.MenuHelper.Menu(MvcSiteMapHtmlHelper helper) in c:\Projects\Codeplex\TFS10\mvcsitemap\Branches\3.1.0\src\MvcSiteMapProvider\MvcSiteMapProvider\Web\Html\MenuHelper.cs:31
我想不出我为引入此错误所做的任何更改。所做的唯一更改是由于使用 StyleCop 的结果(例如更改使用顺序、方法、属性等)。任何的想法?