Edit

Share via


Compiler Error CS1017

Catch clauses cannot follow the general catch clause of a try statement

A catch block that does not take any parameters must be the last in a series of catch blocks. For more information on exceptions, see Exceptions and Exception Handling.

Example

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;  
            }  
        }  
    }  
}