I assume I'm missing something really trivial here but for reason it's not obvious to me. I've always assumed that "finally" always executes, regardless of an exception or not.
Anyway, this code failed to run and I'm not sure why. It gets to i = i/j and throws an DivideByZero exception but I would've thought it would continue and execute the finally statement before stopping.
static void Main(string[] args)
{
int i = 1;
try
{
int j = 0;
i = i / j;
Console.WriteLine("can't get");
}
finally
{
Console.WriteLine("finally ran");
}
}