From a007e43d9c43d6499d2eaeeafc64bd5973039688 Mon Sep 17 00:00:00 2001 From: Tim Pohlmann Date: Mon, 2 Dec 2024 14:42:14 +0100 Subject: [PATCH] Modify rule S3168: Add more exceptions (#4547) --- rules/S3168/csharp/rule.adoc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rules/S3168/csharp/rule.adoc b/rules/S3168/csharp/rule.adoc index b29cdfb0b8a..7ea6d6b2f59 100644 --- a/rules/S3168/csharp/rule.adoc +++ b/rules/S3168/csharp/rule.adoc @@ -10,7 +10,10 @@ Doing so prevents control over the https://learn.microsoft.com/en-us/dotnet/csha === Exceptions -* Methods with the https://learn.microsoft.com/en-us/dotnet/api/system.eventhandler[`EventHandler`] delegate signature. +* Methods implementing an interface +* Methods overriding a base class method +* Virtual methods +* Methods with the https://learn.microsoft.com/en-us/dotnet/api/system.eventhandler[`EventHandler`] delegate signature + Using `void` for `EventHandler` is compliant with the TAP model. + @@ -21,9 +24,9 @@ public async void button1_Click(object sender, EventArgs e) await DoSomethingAsync(); } ---- -* Methods name matching ``++On[A-Z]\w*++`` pattern. +* Methods name matching ``++On[A-Z]\w*++`` pattern + -Some frameworks may not use the same `EventHandler` method signature +Some frameworks may not use the same `EventHandler` method signature. + [source,csharp] ----