[Mono-bugs] [Bug 80229][Nor] New - Segfault in gdb when trying to dereference a null System.Xml.XmlNode object

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Dec 11 17:15:06 EST 2006


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 abockover at novell.com.

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

--- shadow/80229	2006-12-11 17:15:06.000000000 -0500
+++ shadow/80229.tmp.21097	2006-12-11 17:15:06.000000000 -0500
@@ -0,0 +1,35 @@
+Bug#: 80229
+Product: Mono: Runtime
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: atsushi at ximian.com                            
+ReportedBy: abockover at novell.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Segfault in gdb when trying to dereference a null System.Xml.XmlNode object
+
+This is a strange bug, and is only present when running a mono application
+from within gdb.
+
+Take the following code snippet:
+
+XmlNode node = parent.SelectSingleNode("i-do-not-exist");
+Console.WriteLine(node.InnerText);
+
+When not inside gdb, a NullReferenceException will be thrown when
+dereferencing 'node.' However, if running under gdb, a segfault will be
+thrown when dereferencing.
+
+While the developer should always explicitly check for null before
+dereferencing instead of relying on exceptions for flow control, a segfault
+is quite bad. I found this after some code was introduced in Banshee that
+did exactly that (rely on the exception), and I could no longer debug under
+gdb as Banshee would always segfault on startup.


More information about the mono-bugs mailing list