13 September 2015

avoiding the execution of finally block of code in C# .NET

We all know that finally block of code is always going to get executed irrespective of whether there is an exception or not. Thereby finally() block of code helps to clean any resources held up by the code.

But, there is one exception to the above rule.

The finally block of code will not get executed, when the code executes Environment.FailFast() method.