I have code like the one in this question, basically a UI-thread that gets updated from another thread and uses InvokeRequired()
and Invoke(..)
. Now, if the method fails in the work part, the debugger stops on the Invoke(..)
line -can I make it show me the line where it actually failed like it usually does?
views:
53answers:
2
+1
A:
Have you tried having the debugger break on exceptions (in the VS menus: Debug -> Exceptions, navigate to "Common Language Runtime Exceptions" and optionally dig down to a specific exception type, check the Thrown check box)? This will cause the debugger to break at the code line where the exception is thrown. I think this works also in multithreaded scenarios.
Fredrik Mörk
2009-06-09 13:55:15
+1
A:
What you're likely running into is an issue with Just My Code (JMC). This is a feature of the debugger where it tries to limit items like unhandled exception notification to only code that is owned by the user instead of the framework. Try disabling this feature and breaking on thrown exceptions and that should take you to the source of the problem.
Disabling Just My Code
- Go to Tools -> Options
- Navigate to Debugger -> General
- Uncheck the Just My Code option
JaredPar
2009-06-09 14:47:22
This did not work unfortunatly
Niklas Winde
2009-06-16 06:10:10