You need to examine the state of the application when exceptions are thrown

You are developing an ASP.NET MVC application by using Visual Studio.
The application throws and handles exceptions when it runs.
You need to examine the state of the application when exceptions are thrown.
What should you do?

You are developing an ASP.NET MVC application by using Visual Studio.
The application throws and handles exceptions when it runs.
You need to examine the state of the application when exceptions are thrown.
What should you do?

A.
Add the following code to the web.config file of the application.
<customErrors mode=”On” >
<error statusCode=”404” redirect=”CustomErrors.html” />
</customErrors>

B.
From the Debug menu in Visual Studio, select Exceptions. Disable the User‐unhandled check box
for Common Language Runtime Exceptions.

C.
Add the following code to the web.config file of the application.
<customErrors mode=“On” >

<error statusCode=”500” redirect=”CustomErrors.html” />
</customErrors>

D.
From the Debug menu in Visual Studio, select Exceptions. Enable the Thrown check box for
Common Language Runtime Exceptions.

Explanation:
Configuring the debugger to break for first chance exceptions
To change when the debugger breaks, go to Debug‐>Exceptions…


When you first open this window you will see that there is a tree grid with one column and
checkboxes.
* Break when Thrown. This includes a default list of exceptions known by the debugger, grouped by
category.
Note: The possible exceptions that could break from this list is determined by the runtime you are
debugging. For example, if you are using managed‐only debugging then the debugger will never
break for C++, Win32 Exceptions, etc. even if they are configured to break when thrown.
* Checkboxes. If you check the box for a category, then the debugger will break for all First Chance
Exceptions while debugging. If you don’t want to enable all First Chance Exceptions, you can find the
specific exception types that you wish to configure by using the search box.
Understanding Exceptions while debugging with Visual Studio
http://blogs.msdn.com/b/visualstudioalm/archive/2015/01/08/understanding‐exceptions‐while‐
debugging‐with‐visual‐studio.aspx



Leave a Reply 1

Your email address will not be published. Required fields are marked *