[Mono-list] exceptions and ECMA issues

Carl R. Witty cwitty@newtonlabs.com
23 Aug 2001 16:22:37 -0700

Paolo Molaro <lupus@debian.org> writes:

> Basically it says that if an exception id thrown, control is transfered to the
> matching catch block [1] and only later to the finally block [2].
> Partition I, instead, claims that a matching catch block is searched, but
> before executing it, control is transfered to the finally block
> (section
> --snip snip--
> If a match is not found in the current method, the calling method is searched, and so on. If no match is found 
> the CLI will dump a stack trace and abort the program. If a match is found, the CLI walks the stack back to the 
> point just located, but this time calling the finally and fault handlers. It then starts the corresponding exception 
> handler. Stack frames are discarded either as this second walk occurs or after the handler completes, depending 
> on information in the exception handler array entry associated with the handling block. 
> --snip snip--

I think you're misreading the specification here.

Let me give an example.  (Warning: I don't know C#; this is almost
certainly not the correct C# exception handling syntax.)

  try {
    try {
      throw ...;
    } finally {
      // finally handler A
  } catch {
    // catch handler B
  } finally {
    // finally handler C

My reading of the paragraph you quoted above is that you must execute
"finally handler A" before executing "catch handler B".  The other
paragraph you quoted (that I cut from my reply) says you must execute
"catch handler B" before "finally handler C".

Carl Witty