The TargetInvocationException is thrown when an error occurs in a method called via reflection (maybe even an eventhandler), and the error is not caught in the method.
Check if the TargetInvocationException has an inner exception (e.InnerException). That inner exception should be the real exception. If you can figure out what method threw the exception, you could put a try…catch construction around the code in the method, and put a breakpoint in the catch-block. That way, you can debug the code.
Imported from legacy forums. Posted by Tommy (had 7828 views)