Closed kcuzner closed 9 years ago
Sorry for the delay on this. It looks pretty good so I'll pull it into the 4.0 branch. (You may not see this as accepted from a GitHub standpoint, but it's getting accepted sorta manually. :) )
Accepted into develop
branch. Thanks!
Pushed to NuGet in release 4.0.0.
I was using an AggregateService the other day with a method that was generic with the intention of using it to resolve open generics on the fly. Calling this method resulted in a
KeyNotFoundException
.Test which fails:
I made a couple changes to fix the issue. If this isn't an intended use of the AggregateService I'm ok with these not being included.
The problem was that the existing interceptor stored the generic method definition in the invocation map, but the filled-in generic method (is there a term for that? Closed generic?) was used in the lookup. My changes do the following:
KeyNotFoundException
.IInvocation.Method.ReturnType
is always used as the argument in theResolve()
call since thereturnType
found in theSetupInvocationMap
method might not match the return type of the method when it is called. This handles the case when the method is called to resolve a concrete type based on an open generic.All of the tests pass, including the new one I added for testing the resolution of open generics. If there are any issues with the changes I'm more than willing to fix them.
Thanks.