System.Reflection.TargetInvocationException Class

public sealed class TargetInvocationException : ApplicationException

Base Types

Object
  Exception
    ApplicationException
      TargetInvocationException

Assembly

mscorlib

Library

Reflection

Summary

Represents the error that occurs when a method invoked via reflection throws an exception.

Description

The TargetInvocationException 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.]

See Also

System.Reflection Namespace

Members

TargetInvocationException Constructors

TargetInvocationException(System.Exception) Constructor
TargetInvocationException(System.String, System.Exception) Constructor


TargetInvocationException(System.Exception) Constructor

public TargetInvocationException(Exception inner);

Summary

Constructs and initializes a new instance of the TargetInvocationException class.

Parameters

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.

Description

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.

See Also

System.Reflection.TargetInvocationException Class, System.Reflection Namespace

TargetInvocationException(System.String, System.Exception) Constructor

public TargetInvocationException(string message, Exception inner);

Summary

Constructs and initializes a new instance of the TargetInvocationException class.

Parameters

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.

Description

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 is null , 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.]

See Also

System.Reflection.TargetInvocationException Class, System.Reflection Namespace