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

RCS1159 should not be reported for WPF routed events #1387

Closed
nvmkpk opened this issue Feb 7, 2024 · 2 comments · Fixed by #1390
Closed

RCS1159 should not be reported for WPF routed events #1387

nvmkpk opened this issue Feb 7, 2024 · 2 comments · Fixed by #1390

Comments

@nvmkpk
Copy link

nvmkpk commented Feb 7, 2024

Product and Version Used:

Steps to Reproduce:

Have the below code in a WPF project:

using System.Windows;
using System.Windows.Controls;

namespace WpfApp1

public class Control1 : Control
{
    public static readonly RoutedEvent MyRoutedEvent = EventManager.RegisterRoutedEvent("MyRouted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(Control1));

    protected void OnMyRoutedEvent()
    {
        this.RaiseEvent(new(MyRoutedEvent, this));
    }

    public event RoutedEventHandler MyRouted // <-- RCS1159 is reported
    {
        add => this.AddHandler(MyRoutedEvent, value);
        remove => this.RemoveHandler(MyRoutedEvent, value);
    }
}

Actual Behavior:
RCS1159 is reported in above indicated line and changes RoutedEventHandler to EventHandler<RoutedEventArgs>.

Expected Behavior:
RCS1159 is not reported.

@nvmkpk
Copy link
Author

nvmkpk commented Feb 9, 2024

This is also reported in interface implementations. Specifically INotifyCollectionChanged.

@josefpihrt
Copy link
Collaborator

@nvmkpk Please file a new issue.

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 a pull request may close this issue.

2 participants