Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Fix for issue in ActionDescriptor.ExtractParameterFromDictionary and System.Reflection.Missing type [725]

$
0
0
I'm using Castle Windsor to do various AOP stuff in my web application. I'm having an issue with a controller action method with an optional parameter with a default value:

public virtual ActionResult MyActionMethod(int? dummy=null) {}
public virtual ActionResult MyActionMethod(int? dummy=3) {}

Assume that the action is invoked without any matching parameters (e.g. http://host/MyController/MyActionmethod)

The issue is that when the controller action invoker tries to figure out what action to invoke on the controller it blows up at the call to ActionDescriptor.ExtractParameterFromDictionary because instead of a null or 3 value in the arguments it's parsing the argument is of type System.Reflection.Missing.

At this point the extractor should look to verify that the action is optional and has a default value and use that value rather than throw up. I don't think this behavior is incorrect -- Castle passing in System.Reflection.Missing -- and I don't think this is a bug with Castle because it's doing the semantically correct thing (the argument is actually missing).
Comments: The fix is checked in to Castle.Core A new release (3.2.1 I believe) is planned soon, perhaps this weekend, and once it gets to nuget you would be able to easily upgrade your castle assemblies and have the problem fixed. You could also clone the repo at [https://github.com/castleproject/Core], hit __Build NET45__ from the root(important to have the NET45 flag there as only that target has the fix) , and look up the updated Castle.Core from .\Build\NET45\NET45-Release Please let us know if this issue is now resolved for you.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>