[Mono-aspnet-list] ActionNameAttribute not working

sberryman shaun at golfsigma.com
Fri Jul 17 15:42:13 EDT 2009


When using overloaded methods in ASP.NET MVC on Mono I keep getting "key was
not present in the dictionary"

I'm trying to do the following in my controller:

[ActionName("Item")]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ItemPost() {}

[ActionName("Item")]
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult ItemGet() {}

[ActionName("Item")]
[AcceptVerbs(HttpVerbs.Put)]
public ActionResult ItemPost() {}

[ActionName("Item")]
[AcceptVerbs(HttpVerbs.Delete)]
public ActionResult ItemDelete() {}

After testing I was able to narrow the problem down to the
ActionNameAttribute. I started by removing the AcceptVerbs attribute which
had no effect. I then removed the ActionNameAttribute and as expected had
the missing key. When I changed the method name to "Item" it worked as
expected (interesting side note is that if the method name is Item AND I
have the attribute set to "Item" I get the same key not found error.) Any
suggestions? This of course works fine in Windows.


System.Collections.Generic.KeyNotFoundException: The given key was not
present in the dictionary.
  at
System.Collections.Generic.Dictionary`2[System.String,System.Linq.IGrouping`2[System.String,System.Reflection.MethodInfo]].get_Item
(System.String key) [0x00000] 
  at
System.Linq.Lookup`2[System.String,System.Reflection.MethodInfo].get_Item
(System.String key) [0x00000] 
  at System.Web.Mvc.ActionMethodSelector.FindActionMethod
(System.Web.Mvc.ControllerContext controllerContext, System.String
actionName) [0x00000] 
  at System.Web.Mvc.ReflectedControllerDescriptor.FindAction
(System.Web.Mvc.ControllerContext controllerContext, System.String
actionName) [0x00000] 
  at System.Web.Mvc.ControllerActionInvoker.FindAction
(System.Web.Mvc.ControllerContext controllerContext,
System.Web.Mvc.ControllerDescriptor controllerDescriptor, System.String
actionName) [0x00000] 
  at System.Web.Mvc.ControllerActionInvoker.InvokeAction
(System.Web.Mvc.ControllerContext controllerContext, System.String
actionName) [0x00000] 
  at System.Web.Mvc.Controller.ExecuteCore () [0x00000] 
  at System.Web.Mvc.ControllerBase.Execute
(System.Web.Routing.RequestContext requestContext) [0x00000] 
  at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute
(System.Web.Routing.RequestContext requestContext) [0x00000] 
  at System.Web.Mvc.MvcHandler.ProcessRequest (System.Web.HttpContextBase
httpContext) [0x00000] 
  at System.Web.Mvc.MvcHandler.ProcessRequest (System.Web.HttpContext
httpContext) [0x00000] 
  at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest
(System.Web.HttpContext httpContext) [0x00000] 
  at System.Web.HttpApplication+<Pipeline>c__Iterator2.MoveNext ()
[0x00000] 
  at System.Web.HttpApplication.Tick () [0x00000] 
-- 
View this message in context: http://www.nabble.com/ActionNameAttribute-not-working-tp24539820p24539820.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.



More information about the Mono-aspnet-list mailing list