Skip to content
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

Fix support for target object events with certain generic delegates #293

Merged
merged 3 commits into from
Jun 20, 2019

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented Jun 20, 2019

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 the v2.0 branch and verified the test failed. The fix of course makes the test pass.

Fixes #292

AArnott added 3 commits June 20, 2019 04:28
When the delegate's generic type argument is not used directly as the 2nd parameter type in the event handler delegate, a NotSupportedException was thrown starting with pull request microsoft#285.

Fixes microsoft#292
@AArnott AArnott added this to the v2.0 milestone Jun 20, 2019
@AArnott AArnott self-assigned this Jun 20, 2019
@AArnott AArnott merged commit b836f6c into microsoft:v2.0 Jun 20, 2019
@AArnott AArnott deleted the fix292 branch June 20, 2019 16:33
AArnott added a commit that referenced this pull request Oct 30, 2024
Bump build agent to ubuntu 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants