[I had no joy with this on the Windows Forms list last week, so would like to put it to the advanced list. Apologies to those who have already seen it.]
If I have an unhandled exception in a "normal" event handler, such as a button click, the debugger drops me in at the exception site. E.g. private void button1_Click(...) { int naughty = 2; int bang = 10/(naughty-2); // debugger highlights this line } But if I have an unhandled exception in the Paint event, the debugger drops me on the Application.Run statement. E.g. static void Main() { Application.Run(new Form1()); } // debugger highlights this line private void panel1_Paint(...) { int naughty = 2; int bang = 10/(naughty-2); // but I want to be here! } The call stack is all Windows Forms methods (apart from my Main): there's no sign of my Paint handler in the call stack. Do other people see this behaviour? Can anyone explain why it happens? (The call stack bottoms out in a method called PaintWithErrorHandling: I guess this is throwing a new exception instead of just rethrowing mine. But why would it do that?) And on a more practical note, are there any good ways to persuade the debugger to catch Paint-related exceptions at their site? -- Ivan Towlson White Carbon You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.