Short answer: it depends from you machine ^^
As you can see in this MSDN article: http://msdn.microsoft.com/en-us/library/zwc8s4fz.aspx ,
if the exception is unhandled it's up to your system to decide if the Finally statement is executed or not.
Also: you can't return a value in a finally
statement.
The whole method Foo
seems a bit confusing to me.
If your goal is to try a "risky" operation and handle the error you shouldn't rethrow the exception without having the outer code handle that.
So, if you want the RunAll
method to know if there's been an error, you should set it's code inside a try
-catch
statement and rethrow the exception in the Foo
method, without the finally
statement so the rethrown exception "bubbles up" the chain and gets handled in the calling method :)