I have a segment of code that looks like this:
try
{
// Do stuff
operationInfo.success = true;
}
catch
{
operationInfo.success = false;
throw;
}
finally
{
try
{
UploadToServer(operationInfo);
}
catch
{
// Suppress, it's ok if we can't upload to the server
}
}
my question is, what happens to the stack trace in this case if an exception is thrown in the main try block, and then again the finally block actually throws (and handles) another exception in the UploadToServer method? Do you get the stack trace of the last exception that was raised or will it be bubbled up correctly?
I'm looking more for an explanation of how does the IL manage what happens under the hood than a simple "yes or no" answer.
Thx.