I’m reviewing some code for a friend and say that he was using a return statement inside of a try-finally block. Does the code in the Finally section still fire even though the rest of the try block doesn’t?
Example:
public bool someMethod() { try { return true; throw new Exception('test'); // doesn't seem to get executed } finally { //code in question } }
Simple answer: Yes.