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
  • 51,252
  • 26
  • 196
  • 186
mark
  • 53,726
  • 70
  • 260
  • 529

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
  • 55,844
  • 9
  • 67
  • 97