**********method.Invoke Exception has been thrown by the target

You may receive this exception when you use the Invoke() method (of a form perhaps). The cause of this exception is another exception which occured inside the
from:
http://www.geekpedia.com/KB70_Exception-has-been-thrown-by-the-target-of-an-invocation.html

method being invoked.
Since you don't know what actually went wrong inside the method that was being invoked, we will need to get the inner exception of the method.
Suppose we have the following line which invokes a method:

MyForm.Invoke(MyForm.MyDelegate, new Object[] { someParameter });

To catch the exception, enclose the line within a try/catch block and get the InnerException:

try
{
   MyForm.Invoke(MyForm.MyDelegate, new Object[] { someParameter });
}
catch (Exception ex)
{
   MessageBox.Show(ex.InnerException.Message);
}

This should show you the actual exception message inside a message box.
原文地址:https://www.cnblogs.com/luoyaoquan/p/2293301.html