Home » Microsoft » 70-483 » 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.)
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: AC
Explanation/Reference:
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.
yes, should be A and C
Not D because it will ” interfering with the existing error-handling infrastructure”
Why not AD?
D/ It’s possible to use local try/catch without interfering existing error handling
C/ Contrariwise UnhandledExceptionEventHandler() change existing error handling mechanism
And also we can use ‘throw;’ operator inside catch with saved stacktrace. So, why not D?