-
Notifications
You must be signed in to change notification settings - Fork 4
AA2001DoNotUseNotSupportedException
Warning: this wiki page is auto-generated by the Arnolyzer solution-build process. Do not directly edit this page, as your changes will be lost on the next commit. To edit this page, please refer to Contributing to this project.
These wiki pages reflect the state of the project in development, per the last commit. For details of the latest release of the Arnolyzer Analysers, please see the Arnolyzer website.
Report code: AA2001-DoNotUseNotSupportedException
Status | Implemented |
Description | The NotSupportedException is a direct violation of the Liskov Substitution Principle (LSP) and so must not be used |
Category | Liskov Substitution Principle Analyzers |
Enabled by default: | Yes |
Severity: | Error |
From the Liskov Substitution Principle (LSP) article on Wikipedia:
Substitutability is a principle in object-oriented programming. It states that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may substitute objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.)
A subtype (or interface implementation) that throws a NotSupportedException
cannot be used as a substitute to its parent "without altering any of the desirable properties of that program".
Therefore the use of this exception is a violation of the LSP.
There currently aren't any implemented code-fixes for this rule.
This rule cannot be suppressed.