ArgumentNullException Class (System) (original) (raw)

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

public ref class ArgumentNullException : ArgumentException
public class ArgumentNullException : ArgumentException
[System.Serializable]
public class ArgumentNullException : ArgumentException
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class ArgumentNullException : ArgumentException
type ArgumentNullException = class
    inherit ArgumentException
[<System.Serializable>]
type ArgumentNullException = class
    inherit ArgumentException
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ArgumentNullException = class
    inherit ArgumentException
Public Class ArgumentNullException
Inherits ArgumentException

Inheritance

Inheritance

Attributes

Remarks

An ArgumentNullException exception is thrown when a method is invoked and at least one of the passed arguments is null but should never be null.

An ArgumentNullException exception is thrown at run time in the following two major circumstances, both of which reflect developer error:

ArgumentNullException behaves identically to ArgumentException. It is provided so that application code can differentiate between exceptions caused by null arguments and exceptions caused by arguments that are not null. For errors caused by arguments that are not null, see ArgumentOutOfRangeException.

ArgumentNullException uses the HRESULT E_POINTER, which has the value 0x80004003.

For a list of initial property values for an instance of ArgumentNullException, see the ArgumentNullException constructors.

Applies to

See also