Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0724 

Error Message

A throw statement with no arguments is not allowed inside of a finally clause nested inside of the innermost catch clause

The following example generates CS0724 because of the throw statement inside the finally clause block.

Example

The following example generates CS0724.

// CS0724.cs
using System;

class X
{
    static void Test()
    {
        try
        {
            throw new Exception();
        }
        catch
        {
            try
            {
            }
            finally
            {
                throw; // CS0724
            }
        }
    }

    static void Main()
    {
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft