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 unpredictable choice between methods when using method binding. #8905

Conversation

Takoooooo
Copy link
Contributor

@Takoooooo Takoooooo commented Sep 7, 2022

What does the pull request do?

The idea is to only allow the usage in method bindings of methods without any parameters or methods with the parameter type of object. It is possible to decide which overload will be called at runtime but it will cause performance penalties which we want to avoid, currently, we find the correct method in the compile time which is obviously faster.
The complete idea is described by @grokys in this comment.

Breaking changes

This PR will introduce breaking changes in user code because currently we chose the first method in class that has the same name as in the binding. After this PR we chose the method with the parameter of type "object" first,then method without parameters.

Fixed issues

Fixes #5076

@Takoooooo Takoooooo requested a review from a team September 7, 2022 13:47
@Takoooooo Takoooooo marked this pull request as draft September 7, 2022 13:47
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0023662-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@Takoooooo Takoooooo marked this pull request as ready for review September 8, 2022 12:33
@maxkatz6 maxkatz6 merged commit d7924d1 into master Sep 8, 2022
@maxkatz6 maxkatz6 deleted the fix-unpredictable-choice-between-methods-when-using-method-binding branch September 8, 2022 12:58
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0023687-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unpredictable choice between method overloads when binding to command
5 participants