Skip to content

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

Merged
Manodasan Wignarajah (manodasanW) merged 2 commits into
microsoft:masterfrom
mcooley:fix-597
Mar 8, 2022
Merged

Manodasan Wignarajah (manodasanW) merged 2 commits into
microsoft:masterfrom
mcooley:fix-597

Conversation

@mcooley

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@mcooley

Copy link
Copy Markdown
Member Author

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

@asklar

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

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

@asklar

Copy link
Copy Markdown
Member

Manodasan Wignarajah (@manodasanW) could you take a look? LGTM.

@asklar

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@manodasanW

Copy link
Copy Markdown
Member

Thanks Matt Cooley (@mcooley) for this change and Alexander Sklar (@asklar) for the ping. I looked at it and it looks good.

@manodasanW
Manodasan Wignarajah (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