-
Notifications
You must be signed in to change notification settings - Fork 238
Closed
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.
Milestone
Description
Description
If I create an event with a concreate sender it gives the warning S1144 (remove unused code)
i.e. this is gives a warning -
void CustomSwitch_SwitchPanUpdate(CustomSwitch customSwitch, SwitchPanUpdatedEventArgs e)but this is fine -
void CustomSwitch_SwitchPanUpdate(object customSwitch, SwitchPanUpdatedEventArgs e)Repro steps
In the CustomSwitch class i have this -
public delegate void CustomSwitchPanUpdatedEventHandler(CustomSwitch customSwitch, SwitchPanUpdatedEventArgs e);
public event CustomSwitchPanUpdatedEventHandler? SwitchPanUpdate;And I trigger it like this -
SwitchPanUpdate?.Invoke(this, ev);Then in a consuming class I have this -
void CustomSwitch_SwitchPanUpdate(CustomSwitch customSwitch, SwitchPanUpdatedEventArgs e)
{
// Logic
}Expected behaviour
No warning, first parament should be ignored and can be anything not just object
Actual behaviour
Warning
Known workarounds
Setting the first parameter as object
Metadata
Metadata
Assignees
Labels
False PositiveRule IS triggered when it shouldn't be.Rule IS triggered when it shouldn't be.