This blog entry explains how to enable first chance exceptions in Visual Studio. I explained this several people, so this might be a basic configuration but there are many people who apparently do not yet know.
First chance exceptions means that Visual Studio immediately stops when any kind of exception (e.g. NullReferenceException or InvalidOperationException) occurs. Often first chance exceptions are disabled in Visual Studio by default installation. This causes exceptions that can be caught by a catch-block, wherever in call stack, will not stop the debugger at the point of exception creation. The debugger only stops if an exception cannot be handled by any catch-block. So a developer often does not see where the exception was created and thrown.
Depending on your installation of Visual Studio you first have to add an additional command to the menu of your IDE. Therefore select "Tools" menu and click "Customize...".
The "Customize" dialog opens where you can select additional items to be added to your menu or toolbars. Activate the "Commands" tab and select "Debug" in the left list with title "Categories". Select "Exceptions..." item from the right list with title "Commands" and drag it into your "Debug" menu on top of Visual Studio.
Now you can close the Customize dialog by hitting the "Close" button.
Go to menu and select the newly added menu item "Exceptions..." in "Debug" top menu. The new "Exceptions" dialog appears where you can configure the exception behavior of Visual Studio debug sessions. Within the shown list select "Common Language Runtime Exceptions" and activate the "Thrown" check-box on the right side.
To close the dialog use the "Ok" button.
Now you can start debugging your project and Visual Studio stops as soon as any kind of exception occurs.
Happy coding :-)