1

Possible Duplicate:
Why use try {} finally {} with an empty try block?

While stepping through MS .NET code I have stumbled upon this piece:

try { } finally 
{
  // Called in a finally because it needs to run uninterrupted in order to maintain consistency.
  queued = IOThreadScheduler.current.ScheduleCallbackHelper(callback, state);
}

Interesting trick. Can anyone one donate an explanation?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
mark
  • 59,016
  • 79
  • 296
  • 580

1 Answers1

9

This is most likely intended to execute the line in the presence of a ThreadAbortException.

According to the docs:

When this exception is raised, the runtime executes all the finally blocks before ending the thread.

Jeffrey L Whitledge
  • 58,241
  • 9
  • 71
  • 99