- StackOverFlowException - The process has run out of necessary resources, it simply can't execute any more code. Even if the next line of code is to pass control to the "finally" block, it can't get there.
- OutOfMemoryException - See above.
- ExecutingEngineException - It's rare, I've never seen this one. Basically, the .NET runtime b0rked, the application can't continue.
- Environment.FailFast() - Kills the application with extreme prejudice, not allowing it to finish what it was doing.
- Process/Thread is killed by an external process/thread - The application isn't asked nicely to terminate, it's shot in the head by the OS. Note that a ThreadAbortException will attempt to execute a "finally" block before aborting. But there are more sinister ways to kill an enemy process.
- Infinite loop within the try block - The application will run indefinitely until #5 above happens.
- Power failure.
It's just good to keep in mind that a "finally" block is not the end of the discussion when talking about reliable code.
Pretty cool stuff, and thanks for the reminder that Finally blocks are not guaranteed.
ReplyDelete