Closed PetrJasek89 closed 3 days ago
I cannot build and test on my system so I didn't want to create a PR with a fix. I have at least created a path (9695.patch) that should fix the issue. It basically copies the fix that was done for #5536.
I think there could be done a small improvement that would also apply to the WinForms case. In both cases, the containing type will be (has to be) partial
. Therefore check for this could be added as well.
Hello @PetrJasek89,
Thank you for reporting this issue.
I confirm this indeed a false positive. I will add it to our backlog to tackle it later.
Thank you also for you suggested patch, it seems close to what we would need to do to add this exclusion.
Note for the implementation: Exception list on RSPEC need to updated for this rule.
I am closing the issue as it has been moved to our internal backlog for future fix: NET-710
Description
XAML event handlers cannot be static. Currently S2325 is raised on XAML event handlers.
The issue is the same as #5536, only instead of WinForms it applies to XAML.
Repro steps
Expected behavior
No issue raised as XAML cannot handle static event handlers.
Actual behavior
S2325 is raised.
Known workarounds
Suppression attribute added to all affected methods.