-
Notifications
You must be signed in to change notification settings - Fork 27
Description
ExtensionsForMethodInfo.GetPropertyFromMethod(Type t) is throwing an exception when called on a property getter.
The method name is returned as "IGenericStateSetter`1[Boolean].get_Value", therefore the substring(0,3) does not equal "get", as expected. Since it's a property getter method.GetParameterTypes() returns an empty list, so the call to Last() throws an invalid operation exception.
I'm not trying to intercept the method, but I presume a check is being performed as to whether it should be intercepted or not.
I'm also using a Ninject.MockingKernel to create test mocks for any missing bindings. (The issue happens regardless of which mocking framework is used, I think they all use Castle.Proxies)
I don't believe there's any way to specify not to try intercepting an activation?
Stack trace:
System.Core.dll!System.Linq.Enumerable.Last<System.Type>(System.Collections.Generic.IEnumerable<System.Type> source)
Ninject.Extensions.Interception.dll!Ninject.Extensions.Interception.Infrastructure.Language.ExtensionsForMethodInfo.GetPropertyFromMethod(System.Reflection.MethodInfo method, System.Type implementingType) Line 18
Ninject.Extensions.Interception.dll!Ninject.Extensions.Interception.Planning.Strategies.InterceptorRegistrationStrategy.Execute(Ninject.Planning.IPlan plan) Line 47
Ninject.dll!Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map<Ninject.Planning.Strategies.IPlanningStrategy>(System.Collections.Generic.IEnumerable<Ninject.Planning.Strategies.IPlanningStrategy> series, System.Action<Ninject.Planning.Strategies.IPlanningStrategy> action)
Ninject.dll!Ninject.Planning.Planner.CreateNewPlan(System.Type type)
Ninject.dll!Ninject.Planning.Planner.GetPlan(System.Type type)
Ninject.dll!Ninject.Activation.Context.ResolveInternal(object scope)
Ninject.dll!Ninject.Activation.Context.Resolve()
Ninject.dll!Ninject.KernelBase.Resolve(Ninject.Activation.IRequest request, bool handleMissingBindings)
Ninject.dll!Ninject.Planning.Targets.Target<System.__Canon>.ResolveWithin(Ninject.Activation.IContext parent)