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

Prevent false parameter count mismatch when using compiled methods with Returns #654

Merged
merged 5 commits into from
Aug 8, 2018

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Aug 8, 2018

This should resolve #652.

Methods compiled from expression trees can have an additional first
parameter of type `Sytem.Runtime.CompilerServices.Closure` which
apparently captures all closed-over variables.

This additional parameter can trigger a parameter count mismatch error
in `MethodCallReturn.ValidateNumberOfCallbackParameters`.

The test code is taken from:
devlooped#652 (comment)
Apart from extension methods, there is (at least) one other case where
the parameter count needs to be adjusted: static methods that have the
first argument bound to `Delegate.Target`.

Add a clause to check for this additional case.
@stakx stakx added this to the 4.9.1 milestone Aug 8, 2018
@stakx stakx force-pushed the parameter-count-mismatch branch 2 times, most recently from 70be99c to 0af0bf7 Compare August 8, 2018 20:13
@stakx stakx merged commit b8b61a4 into devlooped:master Aug 8, 2018
@stakx stakx deleted the parameter-count-mismatch branch August 8, 2018 21:06
@devlooped devlooped locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Different number of parameters" error when passing to Returns a dynamically compiled Expression
1 participant