Skip to content

RelayCommand does not work on inherited methods #307

@yosefmah

Description

@yosefmah

Describe the bug

Attempting to annotate [RelayCommand] on inherited method results in the following error on compile:

Error MVVMTK0023 The method WpfApp1.InheritedViewModel.WpfApp1.InheritedViewModel.TestMethod() cannot be annotated with [RelayCommand], has it has multiple overloads (command methods must be unique within their containing type)

I'm not sure if this is an intended change, but it worked fine in preview3.

Regression

8.0.0-preview3

Steps to reproduce

1. Add method with [RelayCommand]
2. Create inherited class with the method 
3. Annotate method in inherited class with [RelayCommand]

Expected behavior

I would expect the solution to compile with RelayCommand for both the base and inherited classes

Screenshots

No response

IDE and version

VS 2022

IDE version

17.2.3

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

8.0.0-preview4

Additional context

No response

Help us help you

No, just wanted to report this

Metadata

Metadata

Assignees

No one assigned

    Labels

    by designSome behavior that is intended and not an issuemvvm-toolkit 🧰Issues/PRs for the MVVM Toolkit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions