Troubleshooting Exceptions: System.ArgumentNullException

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

Check arguments to make sure they are not null (Nothing in Visual Basic).

A null reference is a reference to an object that does not exist, often because no instance of the object has been programmatically created.

ArgumentNullException behaves identically to ArgumentException. It is provided so 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 Troubleshooting Exceptions: System.ArgumentOutOfRangeException.

Community Additions