Code Issues – Control cannot leave the body of a finally clause
Returns are forbidden in finally clauses by the compiler. A compiler error will occur in case of a return statement inside a finally block, and refuse to let you write such potentially ambiguous and confusing code. The purpose of a finally statement is to ensure that the necessary cleanup of objects happens immediately and always. In other words, it is designed for releasing all locks and resources and cannot leave the block until finishing the cleanup task.
How to Fix:
- Remove the return statement from a finally block:
—– Products: CodeRush Pro Versions: 12.1 and up VS IDEs: 2008 and up Updated: Oct/18/2012 ID: C201