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

Change return type of CanExecuteChanged only for MUX.Input.ICommand #1092

Merged
merged 2 commits into from
Mar 8, 2022

Conversation

mcooley
Copy link
Member

@mcooley mcooley commented Jan 27, 2022

Fixes #597

Microsoft.UI.Xaml.Input.ICommand is mapped to System.Windows.Input.ICommand. The CanExecuteChanged events on those two types aren't exactly the same, so there is a special case in the code generation to fix up the type mapping. This was introduced in #112.

The check for this special case is currently too broad: it will apply to any event named "CanExecuteChanged" of type "EventHandler", even if that event is part of some unknown-to-cswinrt type that is not mapped to System.Windows.Input.ICommand. (I hit this with the WUX.Input.ICommand type in system XAML--since system XAML is not supported, its types should be treated as unknown-to-cswinrt everywhere.)

This PR makes the check more specific, so it affects only the mapped MUX type.

@asklar
Copy link
Member

asklar commented Feb 25, 2022

thanks @mcooley - with this change, what does CanExecuteChanged get projected to for Windows.UI.Xaml.Input.ICommand?

@mcooley
Copy link
Member Author

mcooley commented Feb 26, 2022

@asklar on Windows.UI.Xaml.Input.ICommand, CanExecuteChanged will be EventHandler<object> instead of EventHandler.

@asklar
Copy link
Member

asklar commented Mar 2, 2022

/azp run

@azure-pipelines
Copy link

Commenter does not have sufficient privileges for PR 1092 in repo microsoft/CsWinRT

@asklar
Copy link
Member

asklar commented Mar 2, 2022

@manodasanW could you take a look? LGTM.

@asklar
Copy link
Member

asklar commented Mar 7, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@manodasanW
Copy link
Member

Thanks @mcooley for this change and @asklar for the ping. I looked at it and it looks good.

@manodasanW manodasanW merged commit 1f274aa into microsoft:master Mar 8, 2022
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.

Projection of XamlUICommand.CanExecuteChanged (system XAML) loses generic type
3 participants