.Net Framework: Finally block is not being called when the exception is not being caught [duplicate]
问题 This question already has answers here : .NET Core: Finally block not called on unhandled exception on Linux (2 answers) What are the uses of “using” in C#? (29 answers) Closed 3 months ago . A simple console application, in Visual Studio 2019, .Net Framework 4.7, Windows: static void Main(string[] args) { try { Console.WriteLine("In try"); throw new IndexOutOfRangeException(); } finally { *// Surprisingly this part is not being executed.* Console.WriteLine("In finally"); Console.ReadLine();