I'm curious about the reason for the current behavior. I modified the
MSDN C# sample code like so:
try
{
try
{
int[] array1={0,0};
int[] array2={0,0};
Array.Copy(array1,array2,-1);
}
finally
{
Console.WriteLine("This statement is always executed.");
throw new Exception("die");
}
}
catch (ArgumentOutOfRangeException e)
{
Console.WriteLine("Error: {0}",e);
}
catch (Exception e)
{
Console.WriteLine("Error: {0}\n",e);
Console.WriteLine("Error: {0}\n",e.InnerException);
}
The result of the above code is that the ArgumentOutOfRangeException
is lost and catch(Exception) is called for "die." I assume the
behavior would be the same in C++. So what is the reason for dropping
the original exception? Being a C++ person, I half expected the
application to terminate when I threw the second exception.
Sean