.NET Framework Class Library
ArgumentNullException Class

Updated: November 2007

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.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Visual Basic (Declaration)
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class ArgumentNullException _
    Inherits ArgumentException
Visual Basic (Usage)
Dim instance As ArgumentNullException
C#
[SerializableAttribute]
[ComVisibleAttribute(true)]
public class ArgumentNullException : ArgumentException
Visual C++
[SerializableAttribute]
[ComVisibleAttribute(true)]
public ref class ArgumentNullException : public ArgumentException
J#
/** @attribute SerializableAttribute */ 
/** @attribute ComVisibleAttribute(true) */
public class ArgumentNullException extends ArgumentException
JScript
public class ArgumentNullException extends ArgumentException

ArgumentNullException is thrown when a method is invoked and at least one of the passed arguments is nullNothingnullptra null reference (Nothing in Visual Basic) but should never be nullNothingnullptra null reference (Nothing in Visual Basic).

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.

System..::.Object
  System..::.Exception
    System..::.SystemException
      System..::.ArgumentException
        System..::.ArgumentNullException
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 2.0, 1.0
Page view tracker