What is a "first chance exception"?

Frederick The Fool picture Frederick The Fool · Feb 19, 2009 · Viewed 25.9k times · Source

What exactly is a first chance exception? How and where does it originate in a .NET program? And why is it called by that peculiar name (what 'chance' are we talking about)?

Answer

annakata picture annakata · Feb 19, 2009

It's a debugging concept. Basically exceptions are thrown to the debugger first and then to the actual program where if it isn't handled it gets thrown to the debugger a second time, giving you a chance to do something with it in your IDE before and after the application itself. This appears to be a Microsoft Visual Studio invention.