Exceptions that can't be caught by try-catch block in application code

Yes, there are some others:

  • The ThreadAbortedException is special. It will always be re-raised when caught unless the catch block calls ResetAbort(). It is entirely uncatchable when the CLR performs a rude abort of the thread. Done when the AppDomain gets unloaded for example, typically at program exit.

  • Any native exceptions thrown by unmanaged code in a thread that got started by native code are uncatchable. The common scenario here is COM components that start their own threads. The CLR is powerless to trap such exceptions, it doesn't know about the thread and can't inject a catch block. If the native code doesn't catch the exception then Windows terminates the process.

  • Any exceptions thrown by finalizers, unless they are critical finalizers. They'll abort the finalizer thread which terminates the process.

  • Starting with .NET 4.0, an ExecutionEngineException is uncatchable. It is thrown by the CLR when it detects that its internal data structures are compromised. Most typically by an AccessViolationException that's raised while the garbage collector is busy. Continuing to execute managed code when the GC heap is compromised is a risky proposition, and exploitable, .NET 4 pulled the plug on it entirely.

  • Starting with the .NET 4.0 version of the CLR, but possibly also present in unmanaged code that you interop with in earlier versions, Microsoft's secure CRT can terminate a program instantly when a security problem is detected. This is not actually an exception under the hood, the process is instantly terminated since the code considers the process compromised and not capable of safely processing exceptions. A common case is where the stack frame of native function is smashed, a common problem in native code and used by viral code to tinker with the return address to run arbitrary code. An attack scenario called "stack buffer overflow". There were a few false alarms in CLR code, early after the .NET 4.0 release but I haven't seen any in quite a while. You can trigger such an abort yourself by writing beyond the bounds of a stackalloc.

  • Quite infamously, exceptions thrown by Windows message handlers when you run code in 32-bit mode in the WOW64 emulation layer on a 64-bit operating system and you have a debugger attached. Best known for the troublesome Load event in Winforms but also present for other messages and in other runtime environments. The ugly details are in this answer.

  • Starting with .NET 4.5, exceptions that Microsoft classifies as Corrupted State Exceptions (CSEs). They can be caught, but that should only ever be done by a top-level exception handler that doesn't do anything but generate a diagnostic for the user's benefit and terminates the app unconditionally. Backgrounder is available in this magazine article.

  • Any exception that is thrown by the jitter before your code can start running cannot be caught or reported. Failure to compile your Main() method is the common case, typically a FileNotFoundException.


  1. Kiaan

    • 2018/2/7

    Definition: An exception is an event, which occurs during the execution of a program, You can learn more in the Advantages of Exceptions section.

  2. Tyson

    • 2019/4/5

    Runtime exceptions can occur anywhere in a program, and in a typical one they can be very numerous. Having to add runtime exceptions in every method declaration would reduce a program's clarity. Thus, the compiler does not require that you catch or specify runtime exceptions (although you can).

  3. Gunner

    • 2018/7/9

    Any code can throw an exception: your code, code from a package written by someone else such as the packages that come with the Java platform, or the Java 

  4. Mason

    • 2015/12/13

    An exception (or exceptional event) is a problem that arises during the execution of a program.

  5. Quincy

    • 2018/7/29

    In this article, you will learn about exceptions in Java. You can declare the exception with the help of the throw keyword.

  6. Julius

    • 2015/2/27

    The following exceptions are thrown by certain C# operations. Common Exception Classes. System.ArithmeticException. A base class for exceptions that occur during arithmetic operations, such as System.DivideByZeroException and System.OverflowException. System.ArrayTypeMismatchException.

  7. Russo

    • 2016/6/16

    Java exceptions can be broken down into one of three categories: In this case, a NullPointerException exception would be thrown.

  8. Dante

    • 2020/7/29

    Design classes so that exceptions can be avoided. A class can provide methods or properties that enable you to avoid making a call that would trigger an exception. For example, a FileStream class provides methods that help determine whether the end of the file has been reached. These can be used to avoid the exception that is thrown if you read

  9. Dangelo

    • 2020/12/11

    Java exceptions can be of several types and all exception types are organized in a fundamental hierarchy. Java Exceptions Hierarchy. The class 

  10. Leo

    • 2015/9/25

    is the basic exception class your program can catch. Other exceptions are derived from this. The basic idea is that the name of the exception represents the problem that occurred and the exception name is intended to be relatively self-explanatory. The exceptions are not all defined in java.lang; some are created to support other libraries such

  11. Mac

    • 2016/11/11

    When an exception is thrown, the CLR will unwind the stack, looking for a method with a catch block for the specific exception type, and it will 

  12. Johnny

    • 2017/10/23

    You can declare the exception with the help of the throw keyword. import java.io.*; class demo1 { public static void main(String args[]) throws IOException { FileInputStream input1 = null; input1 = new FileInputStream("D:/file.txt"); int m; while ((m = input1.read()) != -1) { System.out.print((char)m); } input1.close(); } }

  13. Emory

    • 2021/4/30

    An exception can occur for many different reasons. exceptions cannot simply be ignored, the programmer should take care of (handle) these exceptions.

  14. Raylan

    • 2018/1/18

    Your code can catch this exception (using catch block) and handle it in some rational manner. System-generated exceptions are automatically thrown by the Java run-time system. To manually throw an exception, use the keyword throw. Any exception that is thrown out of a method must be specified as such by a throws clause. Any code that absolutely must be executed after a try block completes is put in a finally block.

  15. Delvina

    • 2021/4/14

    With exception handling, a program can continue executing (rather than Exceptions are thrown when a method detects a problem and is unable to handle it.

  16. Rhett

    • 2019/9/2

    This exception is raised when a method could not convert a string into a numeric format. RuntimeException. This represents any exception which 

  17. Franco

    • 2016/8/16

    The exception will cause the program execution to stop. Let's handle the exception. We wrap the call that might throw an exception into a try block, and the 

Comments are closed.

Recent Posts