This documentation is archived and is not being maintained.

Compiler Error CS1017

Try statement already has an empty catch block

A catch block that does not take any parameters must be the last in a series of catch blocks.

The following sample generates CS1017:

// CS1017.cs
using System;

namespace x
{
   public class b : Exception
   {
   }

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

         catch   // CS1017, must be last catch
         {
         }

         catch(b)
         {
            throw;
         }
      }
   }
}

See Also

Exception Handling Statements

Show: