Another interview question which was expecting a true / false answer and I wasn't too sure.
finally
is executed most of the time. It's almost all cases. For instance, if an async exception (like StackOverflowException
, OutOfMemoryException
, ThreadAbortException
) is thrown on the thread, finally
execution is not guaranteed. This is why constrained execution regions exist for writing highly reliable code.
For interview purposes, I expect the answer to this question to be false (I won't guarantee anything! The interviewer might not know this herself!).