Fix support for target object events with certain generic delegates #293
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem with #285 which introduced this bug is that it assumed that a generic event handler type would take one generic type parameter and that the generic type argument would be used as exactly the second parameter type in the event handler.
The fix is to ignore whether the delegate is generic or not and simply look at the method signature of a delegate's
Invoke
method and match its second parameter type.I defined a test on a commit based on
v2.0.187
(which did not have this bug) to verify the test passes. I then merged the tip of thev2.0
branch and verified the test failed. The fix of course makes the test pass.Fixes #292