TargetInvocationException when Reflection

The exception that is thrown by methods invoked through reflection. The TargetInvocationException is passed a reference to the exception thrown by the method invoked through reflection. The InnerException property holds the underlying exception.

To get original exception please refer below code

try 
{ 
    method.Invoke(target, params); 
} 
catch (TargetInvocationException ex) 
{ 
    ex = ex.InnerException; // ex now stores the original exception 
} 
Was this article helpful? Votes: 0
Article details:
Published date: 12/09/2019 8:25AM
Last updated: 12/09/2019 8:25AM (LS Mark)
Share article: 
Author: LS Mark
Permalink: https://doc.daxonet.com/kb/961480