JetBrains Rider
 
2024.3
Get JetBrains Rider

Code inspection: Some values of the enum are not processed inside 'switch' expression and are handled via exception in default arm

Last modified: 11 February 2024

When using a switch expression with an enum, it is not required to have arms for each enum value — these values will be processed in the _ discard.

This might be intended by the author to handle some unimportant values. But if the _ discard throws an exception, all usages of the switch with non-processed enum values will also throw the exception, which is probably a consequence of adding a new value to the enum and forgetting to update the switch accordingly.