You are developing an application.
The application contains the following code:
When you compile the code, you receive the following syntax error message: "A previous catch clause already catches all exceptions of this or a super type (‘System.Exception’)."
You need to ensure that the code can be compiled. What should you do?
A. Catch the ArgumentException exception instead of the ArgumentNullException exception.
B. Throw a new exception in the second catch block.
C. Catch the ArgumentNullException exception first.
D. Re-throw the exception caught by the second catch block.
A does not look correct to me.
C looks correct but the Q doesn’t look like it’s specified properly.
Catch for ArgumentNullException should be before the general Exception catch. Nothing to do with ArgumentException.
See https://stackoverflow.com/questions/45677206/showing-the-error-a-previous-catch-clause-already-catches-all-exceptions-of-thi
ArgumnetException is base class for ArgumentNullException. A is correct