[Mono-bugs] [Bug 82416][Wis] New - Unhandled Exception Processing Incompatible with .NET 2.0

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Aug 11 22:06:35 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by charlie at nunit.com.

http://bugzilla.ximian.com/show_bug.cgi?id=82416

--- shadow/82416	2007-08-11 22:06:35.000000000 -0400
+++ shadow/82416.tmp.14396	2007-08-11 22:06:35.000000000 -0400
@@ -0,0 +1,100 @@
+Bug#: 82416
+Product: Mono: Runtime
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: charlie at nunit.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Unhandled Exception Processing Incompatible with .NET 2.0
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. Use this test program...
+
+using System;
+using System.Threading;
+
+namespace LegacyUnhandledExceptionPolicy
+{
+	/// <summary>
+	/// Summary description for Class1.
+	/// </summary>
+	class Class1
+	{
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main(string[] args)
+		{
+			AppDomain.CurrentDomain.UnhandledException += new
+UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
+			
+			Console.WriteLine( "Running under version {0}", Environment.Version );
+
+			Thread thread = new Thread( new ThreadStart( ThrowException ) );
+			thread.Start();
+			thread.Join();
+
+			Console.WriteLine( "Continuing after the exception was handled" );
+		}
+
+		private static void ThrowException()
+		{
+			Console.WriteLine( "Throwing an ApplicationException in worker thread..." );
+			throw new ApplicationException( "This exception is unhandled" );
+		}
+
+		private static void CurrentDomain_UnhandledException(object sender,
+UnhandledExceptionEventArgs e)
+		{
+			Exception ex = (Exception)e.ExceptionObject;
+
+			Console.WriteLine( "Handling exception type {0}", ex.GetType().Name );
+			Console.WriteLine( "Message is {0}", ex.Message );
+			Console.WriteLine( "IsTerminating is set to {0}", e.IsTerminating );
+		}
+	}
+}
+ 
+2. Running under MS .NET 1.1 and 2.0 shows the changed behavior. Under 1.1
+the program continues after the exception is handled. Under 2.0 it terminates.
+
+3. Running under Mono 1.0 and 2.0 profiles, the program continues in both cases
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen? 
+
+
+Additional Information:
+1. I'm entering this bug so that the behavior is at least documented. I for
+one don't like the new .NET 2.0 behavior and it would be fine with me if
+Mono kept working as it does.
+
+2. OTOH, if the new behavior is implemented, then the MS workaround using
+the <legacyUnhandledExceptionPolicy> element (qoogle it) has to be
+implemented as well. Otherwise, programs whose *purpose* is to detect and
+report exceptions ( like NUnit, for example ) can't do so.
+
+3. If you create a config file for the sample program, with this element,
+then it works just like Mono under both .NET 1.1 and 2.0.
+
+4. I don't know how MS is handling this in post-2.0 versions of .NET.


More information about the mono-bugs mailing list