NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0157

Control cannot leave the body of a finally clause

All of the statements in a finally clause must execute.

The following sample generates CS0157:

using System;
namespace x
{
   public class b : Exception
   {
   }

   public class a
   {
      public static void Main()
      {
         try
         {
         }

         finally
         {
            return;   // CS0157, cannot leave finally clause
         }
      }
   }
}

See Also

Exception Handling Statements