[Mono-bugs] [Bug 31817][Nor] New - exceptions not properly handled in therads with mono

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
6 Oct 2002 05:29:03 -0000


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 vladimir@pobox.com.

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

--- shadow/31817	Sun Oct  6 01:29:02 2002
+++ shadow/31817.tmp.32759	Sun Oct  6 01:29:02 2002
@@ -0,0 +1,69 @@
+Bug#: 31817
+Product: Mono/Runtime
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: exceptions not properly handled in therads with mono
+
+Given:
+/** startcode **/
+using System;
+using System.Threading;
+
+class TT {
+    public TT () {
+        tt_thread = new Thread (new ThreadStart (TT_Thread));
+        tt_thread.Start ();
+    }
+
+    public Thread tt_thread;
+
+    void TT_Thread ()
+    {
+        try {
+            throw new InvalidOperationException ();
+        } catch (Exception e) {
+            Console.WriteLine ("exception");
+        }
+    }
+}
+
+class Driver {
+    static void Main (string[] args) {
+        TT tt = new TT();
+        while (true) {
+        }
+    }
+}
+/** endcode */
+
+When running with mono results in:
+
+vladimir@rain[1385]% mono bar.exe
+exception
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required
+in <0x00072> 00 .TT:TT_Thread ()
+
+zsh: segmentation fault  mono bar.exe
+
+When run with mint, it produces the expected 'exception' and then sticks
+around forever.
+
+Note that while the generated code PEVerify'd correctly under windows, it
+did not run correctly.  It locked as soon as ./bar.exe was started and had
+to be killed from the task manager.  Compiling bar.cs on windows gave the
+desired behaviour; copying the resulting (csc-compiled) assembly back to
+linux gave the same results as the mcs-compiled executable.