TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  8@107Checked automatically with code checker

Synopsis:Use standard exceptions
Language:C#
Severity Level:3
Category:Exceptions


Description:

The following list of exceptions are too generic and should not be raised directly by your code:

  • System.Exception
  • System.ApplicationException
  • Any exception which is reserved for use by the CLR only (check MSDN for this)

The .NET framework already provides a set of common exceptions. The table below summarizes the most common exceptions that are available for applications.

EXCEPTIONCONDITION
InvalidOperationExceptionAn action is performed which is not valid considering the objectís current state.
NotSupportedExceptionAn action is performed which is may be valid in the future, but is not supported.
ArgumentExceptionAn incorrect argument is supplied.
ArgumentNullExceptionA null reference is supplied as a methodís parameter that does not allow null.
ArgumentOutOfRangeExceptionAn argument is not within the required range.