[Mono-bugs] [Bug 74252][Nor] New - NullReferenceException not caught when invoking methods on null objects.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 30 Mar 2005 21:28:53 -0500 (EST)


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 latexer@gentoo.org.

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

--- shadow/74252	2005-03-30 21:28:53.000000000 -0500
+++ shadow/74252.tmp.5674	2005-03-30 21:28:53.000000000 -0500
@@ -0,0 +1,51 @@
+Bug#: 74252
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: latexer@gentoo.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException not caught when invoking methods on null objects.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+On mono-1.1.5, compiled with --with-sigaltstack=yes --with-preview=yes
+--with-tls=__thread, seems to be unable to handle catching a
+NullReferenceException thrown as the result of trying to invoke methods on
+null objects.
+
+Here's a small test case that reproduces the problem:
+
+using System;
+
+public class ExceptionThrower
+{       
+        public static void Main (string[] args)
+        {       
+                try
+                {       
+                        Array foo = null;
+                        foo.Clone();
+                } catch (NullReferenceException e) {
+                        Console.WriteLine("Caught!");
+                }
+        }
+}
+
+
+Running this on 1.1.5 causes the exception not to be caught. On 1.0.5, this
+is handled properly and "Caught!" gets printed to the screen. If the
+section in the try block is replaced with just a "throw new
+NullReferenceException()", the exception actually gets caught on both 1.0.5
+and 1.1.5 though.