It is expected that some methods should be called with caution, but others, such as
ToString, are expected to "just work". Throwing an
exception from such a method is likely to break callers' code unexpectedly.
An issue is raised when an exception is thrown from any of the following:
- Event accessors
- Module initializers
==, !=, <, >, <=, >=
implicit cast operators
Noncompliant Code Example
public override string ToString()
throw new ArgumentException("..."); // Noncompliant
System.NotImplementedException and its derivatives are ignored.
System.ArgumentException and their
derivatives are ignored in event accessors.