AutoMapper/AutoMapper — pull request #584 by TylerCarlson1 (2014-09-07 01:49:36+00:00)
Title: Addressing issues with ExpressionMapper logic.

There are some possible scenarios with solution #294 that would cause weird exceptions to occur.

Things not accounted for were if you were mapping expressions of functions to expressions of actions with the same amount of variables would get casting exception trying to convert a function to an action.
What this change does is account for it in the same line as the generic parameter count is accounted for so it's now looking at the generic type as a whole instead of the individual parameters.

Also with Func, the last generic variable is return type so there is no parameter for it. If the last type was different then would get index out of array exception, so I changed to only parameters go through. Don't think you can change return type at all, just hope there return types match up based on the expression you are going for.

These issues probably won't come up, at least for a good while, but if they do come up the exceptions are going to be very confusing.

On another note my pull request for issue #528 has a mapper that does this same type of thing. It will need to be removed before before it can be pushed over.