[Mono-bugs] [Bug 419222] New: Different finally behaviour compared to MS

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Aug 21 10:40:57 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=419222


           Summary: Different finally behaviour compared to MS
           Product: Mono: Runtime
           Version: 2.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: awunwpa7 at yahoo.com.ph
         QAContact: mono-bugs at lists.ximian.com
          Found By: Beta-Customer


There is a different behaviour in MONO compared to MS runtime / framework. When
I set up global unhandled exception handling routines, I find the following
issue:

The MS runtime executes my exception handlers AFTER all finally blocks of the
thread were exectuted. The MONO runtime FIRST executes my exeption handler,
then executes all the finally blocks of the thread.

Is this expected? Have I set up exception handlers the wrong way?


Test case:

public void foo()
{
   Application.ThreadException +=
            new UnhandledExceptionEventHandler(UIHandler);
   AppDomain.CurrentDomain.UnhandledException +=
            new ThreadExceptionEventHandler(OtherHandler);
  
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

  try
  {
        throw (new Exception());
  }
  finally
  {
        Console.WriteLine("Finally");
  }
}

private static void UIHandler(object sender, ThreadExceptionEventArgs e)
{
   Console.WriteLine("Handler 1");
}

private static void OtherHandler(object sender, UnhandledExceptionEventArgs e)
{
   Console.WriteLine("Handler 2");
}



Tested MS framework: 2.0


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list