How to solve: “exception was thrown by the target of invocation” C#

前端 未结 4 468
生来不讨喜
生来不讨喜 2020-12-10 12:18

C#

Every time I run my porgram I get this exception: \"alt

But when I run in debug mode, there i

4条回答
  •  一生所求
    2020-12-10 12:50

    TargetInvocationException masks the real exception by telling you that it crashed during "a method invocation", usually through something.Invoke.

    What you have to do is look at the InnerException property of the exception object (the TargetInvocationException object), this will give you the actual exception that was thrown, with a more useful stack trace.

提交回复
热议问题