Is there any case where catch block is skipped when an Exception is raised
say
try
{
some code
}
catch(Exception ex)
{
some code
}
I am using Exception class as it catches all the Exceptions.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You might have problems with
StackOverflowException(see List of exceptions that CAN'T be caught in .NET)There is another family of cases, specifically when the thing thrown wasn’t an
Exception, but this is only if you are either in 1.1, or don’t have automatic exception wrapping enabled (it is enabled by default from 2.0) – it is theoretically possible for C++ to throw anything (not just anException), so if your “some code” calls into some C++ that throws, say, astring, then in theory you could miss it.In reality this is rarely (if ever) a real problem:
Exception(or a subclass) to be well-behavedIn such cases, a
catch { ... }will work to intercept that something was thrown, but won’t tell you what happened.