Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8402667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:07:49+00:00 2026-06-09T22:07:49+00:00

According to the CLI standard (Partition IIA, chapter 19) and the MSDN reference page

  • 0

According to the CLI standard (Partition IIA, chapter 19) and the MSDN reference page for the System.Reflection.ExceptionHandlingClauseOptions enum, there are four different kinds of exception handler blocks:

  • catch clauses: “Catch all objects of the specified type.”
  • filter clauses: “Enter handler only if filter succeeds.”
  • finally clauses: “Handle all exceptions and normal exit.”
  • fault clauses: “Handle all exceptions but not normal exit.”

Given these brief explanations (cited from the CLI Standard, btw.), these should map to C# as follows:

  • catch — catch (FooException) { … }
  • filter — not available in C# (but in VB.NET as Catch FooException When booleanExpression)
  • finally — finally { … }
  • fault — catch { … }

Experiment:

A simple experiment shows that this mapping is not what .NET’s C# compiler really does:

// using System.Linq;
// using System.Reflection;

static bool IsCatchWithoutTypeSpecificationEmittedAsFaultClause()
{
    try
    {
        return MethodBase
               .GetCurrentMethod()
               .GetMethodBody()
               .ExceptionHandlingClauses
               .Any(clause => clause.Flags == ExceptionHandlingClauseOptions.Fault);
    }
    catch // <-- this is what the above code is inspecting
    {
        throw;
    }
}

This method returns false. That is, catch { … } has not been emitted as a fault clause.

A similar experiment shows that in fact, a catch clause was emitted (clause.Flags == ExceptionHandlingClauseOptions.Clause), even though no exception type has been specified.

Questions:

  1. If catch { … } really is a catch clause, then how are fault clauses different from catch clauses?
  2. Does the C# compiler ever output fault clauses at all?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:07:50+00:00Added an answer on June 9, 2026 at 10:07 pm

    there are four different kinds of exception handler blocks:

    • catch clauses: "Catch all objects of the specified type."
    • filter clauses: "Enter handler only if filter succeeds."
    • finally clauses: "Handle all exceptions and normal exit."
    • fault clauses: "Handle all exceptions but not normal exit."

    Given these brief explanations (cited from the CLI Standard, btw.), these should map to C# as follows:

    • catch — catch (FooException) { … }
    • filter — not available in C#1 (but in VB.NET as Catch FooException When booleanExpression)
    • finally — finally { … }
    • fault — catch { … }

    It’s that last line where you went wrong. Read the descriptions again. fault and finally are described practically identically. The difference between them is that finally is always entered, whereas fault is only entered if control leaves the try via an exception. Note that this means that a catch block may have already acted.

    If you write this in C#:

    try {
        ...
    } catch (SpecificException ex) {
        ...
    } catch {
        ...
    }
    

    Then there is no way that the third block will be entered if control leaves the try via a SpecificException. That’s why catch {} isn’t a mapping for fault.


    1Since people keep mentioning this in the comments, a) This part of the answer is a quote from the original question and b) yes, when clauses have subsequently been added to C#. It was however accurate at the time of asking and isn’t what this answer focusses on answering.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to the C++11 standard, is the following program well-formed and portable C++? int
According MSDN, FxCop is an application that analyzes managed code assemblies (code that targets
According to the HttpListener reference , a call to HttpListener.GetContext will block until it
According to Microsoft ( link ), there are two ways to start a task:
According to C++11 9.1/7 (draft n3376) , a standard-layout class is a class that:
According to the MSDN article found at http://msdn.microsoft.com/en-us/library/wyk4d9cy.aspx the floating-point value .1 has no
According to MSDN is: The using directive has two uses: 1)To allow the use
According documentation: System.Array.Sort<T> - sorts the elements in an entire System.Array using the System.IComparable
According to C++ Standard paragraph 3.7.3/1 objects should be dynamically created with new expression
According to Wikipedia, on the Comparison of programming languages page, it says that F#

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.