This is a migrated thread and some comments may be shown as answers.

Version 2012.2.607 issue in ControllerAuthorization.IsAccessibleToUser method

3 Answers 99 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrei
Top achievements
Rank 1
Andrei asked on 22 Jun 2012, 06:02 AM
In the previous version everything worked fine. Now I'm sometimes getting the following error:
[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.Mvc.Infrastructure.Implementation.ControllerAuthorization.IsAccessibleToUser(RequestContext requestContext, String controllerName, String actionName, RouteValueDictionary routeValues) +105
   Telerik.Web.Mvc.Infrastructure.Implementation.NavigationItemAuthorization.IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem) +218
   Telerik.Web.Mvc.UI.<>c__DisplayClass2`1.<IsAccessible>b__1(T item) +47
   System.Linq.Enumerable.Any(IEnumerable`1 source, Func`2 predicate) +151
   Telerik.Web.Mvc.UI.NavigatableExtensions.IsAccessible(IEnumerable`1 items, INavigationItemAuthorization authorization, ViewContext viewContext) +185
   Telerik.Web.Mvc.UI.NavigationItemContainerExtensions.WriteItem(TItem item, TComponent component, IHtmlNode parentTag, INavigationComponentHtmlBuilder`1 builder) +643
   Telerik.Web.Mvc.UI.<>c__DisplayClass4.<WriteHtml>b__3(MenuItem item) +24
   Telerik.Web.Mvc.Extensions.EnumerableExtensions.Each(IEnumerable`1 instance, Action`1 action) +135
   Telerik.Web.Mvc.UI.Menu.WriteHtml(HtmlTextWriter writer) +230
   Telerik.Web.Mvc.UI.ViewComponentBase.Render() +82
   Telerik.Web.Mvc.UI.ViewComponentBuilderBase`2.Render() +22


I see that now you changed implementation of IsAccessibleToUser(RequestContext requestContext, string controllerName, string actionName, RouteValueDictionary routeValues) method. I don't know on which line of code it happens (because do not use "ArgumentNullException"). But I presume that I happens on line 75: 
var authorizeAttributes = FilterProviders.Providers.GetFilters(authorizationContext.Controller.ControllerContext, authorizationContext.ActionDescriptor).Select(f => f.Instance).OfType<AuthorizeAttribute>().ToList();
You do not validate whether returned "authorizationContext" is null ( you do it later). Please fix it.

Please note that all my URLs specified in sitemap.config file are valid.  Or at least throw a descriptive exception which controller/action is missing.

3 Answers, 1 is accepted

Sort by
0
Simon
Top achievements
Rank 1
answered on 26 Jun 2012, 01:11 PM
HI,

I have the same Problem, but the error occurs always.

Greetings
Simon Schäberle
0
Craig
Top achievements
Rank 1
answered on 26 Jun 2012, 03:06 PM
Same issue here.  Have you figured out a workaround or fix?
0
Atanas Korchev
Telerik team
answered on 26 Jun 2012, 03:21 PM
Hello,

 Please check this sticky forum thread: http://www.telerik.com/community/forums/aspnet-mvc/menu/another-controllerauthorization-isaccessibletouser-error-in-q2-2012.aspx 

Regards,
Atanas Korchev
the Telerik team
Check out the successor of Telerik MVC Extensions - Kendo UI for ASP.NET MVC - and deem it for new ASP.NET MVC development.
Tags
Menu
Asked by
Andrei
Top achievements
Rank 1
Answers by
Simon
Top achievements
Rank 1
Craig
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or