News Item - Does Any Language Targeting the CLR Generate a Fault Block?

04.28.2008 11:42:13 AM (Last Update: 06.09.2008 11:40:20 AM)

One thing I need to add to ExceptionFinder is the ability to handle fault and filter blocks. VB generates filter blocks, but I don't know of any language that generates a fault block. Supposedly, Boo...might. This post says it does (as try-failure), but the docs here doesn't mention that syntax.

I'm still going to add support for it (it's easy to generate a dynamic assembly with a fault block) but I'm just curious if any language actually uses the fault block. If you of one (other than IL :) ) please add it in the comments - thanks!

UPDATE: Eric Eilebrecht (who had tried to post the comment but couldn't do so for unknown reasons) told me that C# will generate a fault block with this code:

public IEnumerable<int> Iterator()
{
    try
    {
        yield return 1;
    }
    finally
    {
        Console.WriteLine("done");
    }
}

Basically, he stated, "C# generates fault blocks in iterator methods."

Page Last Modified: 01.21.2008 03:08:19 PM