public sealed class TargetInvocationException : ApplicationException
Object
Exception
ApplicationException
TargetInvocationException
mscorlib
Reflection
Represents the error that occurs when a method invoked via reflection throws an exception.
TheTargetInvocationException
constructors are passed a reference to the exception thrown by the invoked method. [Note: The System.Reflection.TargetInvocationException.InnerException property inherited from Exception holds the exception.]
System.Reflection Namespace
TargetInvocationException Constructors
TargetInvocationException(System.Exception) Constructor
TargetInvocationException(System.String, System.Exception) Constructor
public TargetInvocationException(Exception inner);
Constructs and initializes a new instance of the TargetInvocationException class.
- inner
- The Exception that is the cause of the current exception. If the inner parameter is not
null
, the current exception was raised as a result of the inner exception being thrown by a method invoked via reflection.
This constructor initializes the System.Reflection.TargetInvocationException.Message property of the new instance to a system-supplied message that describes the error, such as "Exception has been thrown by the target of an invocation." This message takes into account the current system culture.
System.Reflection.TargetInvocationException Class, System.Reflection Namespace
public TargetInvocationException(string message, Exception inner);
Constructs and initializes a new instance of the TargetInvocationException class.
- message
- A String that describes the error. The content of message is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
- inner
- The Exception that is the cause of the current exception. If inner is not
null
, the current exception was raised as a result of inner being thrown by a method invoked via reflection.
This constructor initializes the System.Reflection.TargetInvocationException.Message property of the new instance using message, and the System.Reflection.TargetInvocationException.InnerException property using inner. If message isnull
, the System.Reflection.TargetInvocationException.Message property is initialized to a system-supplied message that describes the error, such as "Exception has been thrown by the target of an invocation." This message takes into account the current system culture.[Note: For information on inner exceptions, see System.Exception.InnerException.]
System.Reflection.TargetInvocationException Class, System.Reflection Namespace