Debugging TargetInvocationException

五迷三道 提交于 2019-12-10 14:54:07

问题


I'm using Visual Studio 2008 (C# Express Edition) and I'm trying to debug a TargetInvocationException that occurs as a result of an event that I trigger.

My question isn't specificly about this exception, (hence why I've not included any detail about this exception), but more about using the IDE effectively to debug this.

I can see the inner exception gives me the detail I need to debug the error (clicking on 'View Detail' in the exception helper), but being fairly lazy, or should I say, trying to make good use of the tools I have at my disposal, I'd like to be able to convince the IDE to show me the exception helper for original (Inner Exception) within my code for the correct thread, complete with stack trace, rather than showing me the exception details for the calling thread.

Is this possible, and if so, how do I go about doing this?


回答1:


You can tell debugger to break on CLR exception so that you can see the exact place where it is throwing exception.

You can check it under Debug -> Exceptions.

You can find it here -




回答2:


Exception Assistant Dialog Box might help you - http://msdn.microsoft.com/en-us/library/2ww37f14.aspx



来源:https://stackoverflow.com/questions/20452431/debugging-targetinvocationexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!