I recently started playing with Feather and found an issue that has me baffled.
I had an existing MVC widget that was working fine until I enabled Feather to make use of the MVC Video Gallery widget.
I didn't expect it would break anything by just being enabled but perhaps you can tell me if I did something wrong.
The original widget has an action "CreateItem" that returns the associated view, and
another CreateItem(itemModel) with [HttpPost] to accept the post.
Despite this separation, posting the form for that action resulted in the error:
[AmbiguousMatchException: Ambiguous match found.]
System.RuntimeType.GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConv, Type types, ParameterModifier modifiers) +12226787
System.Type.GetMethod(String name, BindingFlags bindingAttr) +31
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.CustomActionParamsMapper..ctor(ControllerBase controller, Func`1 routeTemplateResolver, String actionName) +55
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.DynamicUrlParamActionInvoker.GetInferredPagingMapper(ControllerBase controller, String actionName) +208
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.DynamicUrlParamActionInvoker.GetDefaultParamsMapper(ControllerBase controller) +103
Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing.DynamicUrlParamActionInvoker.InitializeRouteParameters(MvcProxyBase proxyControl) +129
Telerik.Sitefinity.Mvc.ControllerActionInvoker.TryInvokeAction(MvcProxyBase proxyControl, String& output) +136
Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy.OnPreRender(EventArgs e) +20
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +883
Hours of decompiling and a million breakpoints later, I discovered this method:
IUrlParamsMapper GetInferredPagingMapper(ControllerBase controller,
ActionDescriptor actionDescriptor = (
)actionDescriptor.GetParameters().Length == 0 || actionDescriptor.GetParameters().ParameterType !=
CustomActionParamsMapper(controller, () =>
which at runtime contained the action name "Index". Since this is clearly not the action I expected or defined for the form I was confused.
Tracing back revealed this method:
IUrlParamsMapper GetDefaultParamsMapper(ControllerBase controller)
IUrlParamsMapper urlParamsMapper =
urlParamsMapper = urlParamsMapper.SetLast(
which as you can see hardcodes the value of "Index".
If I'm not mistaken, it appears that Feather is first searching for this exact action name "Index", and if it is not found, then will search for the custom action name.
This sounds very unusual to me, and the error was unexpected, especially since the error message had no reference to the "Index" method it was using instead of the method I specified, so it was only by accident (and a lot of source hacking) that I stumbled on this.
It turns out that indeed the original MVC widget has two index methods, one for GET and one for POST, and it is my suspicion that this is what was tripping it up.
I confirmed this by changing the names of these methods on my controller from Index to Default, which immediately resolved the error!
SO... my question is, what did I do wrong? Am I not supposed to use Index as an action name? why is the "Index" action passed as a default value for the controller action?
I also found another that uses "Details" instead of "index" as the default method.. is this a similar situation? why is this done?
Finally, am I the only one who has experienced this? If so surely I did do something wrong, because I can't imagine I'm the only one who uses "Index" as the default name for their controller actions...
I'd appreciate any insight as I do like Feather so far, but if I'm using it wrong I definitely need to know! thanks