6

When I generate a dump file using ADPlus, I get both First chance and second chance exception but when I use task manager for generating dump file, I only get once dump file. Is it the second chance exception? I am bit confused about this 1st and 2nd chance exception anyways even though i have read a little bit about it. May be if someone can provide some good analogy, that might clear up things for me

imak
  • 6,489
  • 7
  • 50
  • 73

1 Answers1

12

See here: Link

In short, First chance exception gives the debugger a first chance to inspect the exception and application state before the application handles the exception.

You can stop the debugger at this point (it' usually a setting like "break into debugger when exception is created". Often this is off by default). If you don't, or if you let the application continue to run, the exception is passed on to the application.

The debugger gets a second chance at the exception when the application doesn't handle it. Again, you can break into the debugger here (this isusually on by default).

Note that if the application doesn't handle the exception, the application will usually terminate.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
peterchen
  • 40,917
  • 20
  • 104
  • 186
  • To add, if a debugger catches a second chance exception, since the application never handled it, the exception would have been brought to the operating system to handle (usually by displaying an error and closing the program). – Dlongnecker Nov 01 '10 at 15:07
  • 1
    Does it mean same process does not happen when dump fils is generated via task manager; cuz i only get one dump file in that case? And which dump am I getting via task manager, is it first chance or second chance? – imak Nov 01 '10 at 16:15
  • 1
    @imak: It's second chance - at first chance, the OS doesn't know yet if the exception gets handled by the applicaiton. Also see update. ---- @Ziplin: I've added it to the reply. – peterchen Nov 01 '10 at 20:43