InnerException Property
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Gets the Exception instance that caused the current exception.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public ReadOnly Property InnerException As Exception
public Exception InnerException { get; }
public:
property Exception^ InnerException {
Exception^ get ();
}
member InnerException : Exception with get
function get InnerException () : Exception
Property Value
Type: System. . :: . .Exception
An instance of Exception that describes the error that caused the current exception. The InnerException property returns the same value as was passed into the constructor, or a null reference (Nothing in Visual Basic) if the inner exception value was not supplied to the constructor. This property is read-only.
Remarks
When an exception X is thrown as a direct result of a previous exception Y, the InnerException property of X should contain a reference to Y.
Use the InnerException property to obtain the set of exceptions that led to the current exception.
You can create a new exception that catches an earlier exception. The code that handles the second exception can make use of the additional information from the earlier exception to handle the error more appropriately.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.