Which two actions should you perform?

An application is throwing unhandled NullReferenceException and FormatException errors. The stack trace
shows that the exceptions occur in the GetWebResult() method.The application includes the following code to parse XML data retrieved from a web service.
(Line numbers are included for reference only.)

You need to handle the exceptions without interfering with the existing error-handling infrastructure.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)

An application is throwing unhandled NullReferenceException and FormatException errors. The stack trace
shows that the exceptions occur in the GetWebResult() method.The application includes the following code to parse XML data retrieved from a web service.
(Line numbers are included for reference only.)

You need to handle the exceptions without interfering with the existing error-handling infrastructure.
Which two actions should you perform? (Each correct answer presents part of the solution.
Choose two.)

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
A: The TryParse method is like the Parse method, except the TryParse method does not throw an exception if
the conversion fails. It eliminates the need to use exception handling to test for a FormatException in the event
that s is invalid and cannot be successfully parsed.
C: UnhandledException event handler
If the UnhandledException event is handled in the default application domain, it is raised there for any
unhandled exception in any thread, no matter what application domain the thread started in. If the thread
started in an application domain that has an event handler for UnhandledException, the event is raised in that
application domain.



Leave a Reply 2

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


Paul

Paul

In think it should be A & D instead of A & C.

It all boils down to what is meant with “the existing error-handling infrastructure”.
“C” affects the application wide error handling,
“D” only the error handling in the try-block.

Another argument for A and D:
A is the functional equivalent of D, i.e. TryParse == try { Parse } catch { }