gui-thread

How do I catch an exception in a GUI thread?

An exception is thrown in a user control based on a picture box, causing it to show the typical error image (red X). Since the GUI thread caught and handled the exception itself, I cannot easily find out where the exception occurred and debug. I'm currently wrapping the whole OnPaint code in a try-catch, and was able to debug the code, ...