[Windsor] Support interception for services created UsingFactoryMethod
It would be interesting if Windsor could support the interception of calls made to services created via the 'UsingFactoryMethod' syntax:
Currently, this will generate the following exception when any member of the resolved service is called:
System.NotImplementedException: This is a DynamicProxy2 error: the
interceptor attempted to 'Proceed' for method 'Int32
DoSomething(Int32)' which has no target. When calling method without
target there is no implementation to 'proceed' to and it is the
responsibility of the interceptor to mimic the implementation (set
return value, out arguments etc)
Had the same issue (IModelInterceptorsSelector) and also discovered this at late stage and now need to change the implementation, also documentation didn’t mention any such limitation.
I think it can be supported by the framework.
Mark Seemann commented
I just spent a couple of hours before discovering that there might be an issue here, so I'd appreciate this ability.
However, my approach was slightly different than above because I implemented IModelInterceptorsSelector, but it turns out that the HasInterceptors method is never called with the service in question because it has been registered with UsingFactoryMethod.