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: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to