C# switch - "goto" statement should not be used

Current version of Sonarlint gives this: “goto” statement should not be used. in a switch/case statement. As this is the only way one can fall through, and is in the C# documentation specifically for this use, this rule should not fail in a switch statement.

Hello @StanSpotts,

The rule itself is a code smell, not a bug, indicating that the code might be hard to understand. Using goto as a fallthrough mechanism is technically a valid case, but so is using goto in any other case. Even for such a use, this might be error-prone and can be written in an alternative way, such as using a direct fallthrough (cases without any statement), or extracting the common case body inside a method.