TargetInvocationException - How to break on the correct line
Posted on 2017-09-26
In many modern applications, you use Task or Threads to optimize your code. But when an exception occurred, you receive a generic exception like System.Reflection.TargetInvocationException: ‘Exception has been thrown by the target of an invocation.’
To avoid that in Visual Studio, go to Option / Debugging / General, and check Enable Just My Code. The result will be like that.