-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Forward non-intercepted methods on class proxies to target #450
WIP: Forward non-intercepted methods on class proxies to target #450
Conversation
src/Castle.Core/DynamicProxy/Contributors/WrappedClassMembersCollector.cs
Outdated
Show resolved
Hide resolved
The (failing) test being added here specifies that if one chooses via `IProxyGenerationHook.ShouldInterceptMethod` not to intercept a method then invocations of that method on the proxy should be forwarded to the target object (if present).
1cafbc2
to
7228bf7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stakx just a couple of comments.
src/Castle.Core/DynamicProxy/Contributors/WrappedClassMembersCollector.cs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Methods which are filtered out by `MembersCollector` (e.g. because the hook's `ShouldInterceptMethod` returned false) are hereby made visible to the proxy-class-with-target generator. Some methods must still be excluded: `ForwardingMethodGenerator` does not perform any accessibility checks, so we need to check whether the target method is callable "from the outside". For most cases, a simple `method.IsPublic` check suffices, however we might want to test if the target method is callable through an interface.
7228bf7
to
3ae08b8
Compare
Once again, this is going to take more work than anticipated. What is needed here is a utility method that checks accessibility of a member (Also, we might be able to reimplement I'll ping you once I'm done. |
Haha, as always with DP.
👍 |
@stakx how about this one? |
Same here. I'll eventually get back to it. |
This should resolve #67.
(At least as far as is possible: non-interceptable methods such as non-virtual, sealed, or private methods of course still cannot be forwarded to the proxy.)