A finally block does not always xecute. The code in the try block could go into an infinite loop, the exception could rigger a “fail fast” (which takes the process down without running any finally locks), or someone could pull the power cord out of the wall.
eg.
static void TryFinallyDemo() { try { while(true) { Console.WriteLine(DateTime.Now.ToString("yyyyMMddHHmmssffff")); } } finally { Console.WriteLine("Finally block does not always execute!"); } }
来源:https://www.cnblogs.com/Fred1987/archive/2020/02/28/12377523.html