2
Vote

Menu Item will fail to render if decorated with Attribute with no default constructor

description

I implemented Mvc's built in AuthorizeAttribute (as is described in Pro ASP.NET MVC Framework) but when I decorated an action method with my Authorize attribute, the menu item created with the MenuBuilder pointing to that action method (via the Action(string, string) builder method) stopped rendering.
 
After some debugging it became apparent that the lack of a default constructor on my implementation was the cause, so I added one and the menu item appeared again.
 
My bug is not that it failed, but that it failed silently - this is worthy of an exception with relevant details. I can provide an MVC2 repro project if need be.

comments

Realrs wrote Sep 13, 2011 at 3:30 PM

I have same problem with my custom attribute that delivered from AuthorizeAttribute.

wrote Feb 21, 2013 at 10:58 PM