2018-04-27

TargetInvocationException – How to break on the correct line

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.

Leave a Reply

Your email address will not be published. Required fields are marked *