[Mono-bugs] [Bug 39920][Nor] New - System.Xml is throwing an exception where .NET just returns null

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 18 Mar 2003 15:47:34 -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 synced_@hotmail.com.

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

--- shadow/39920	Tue Mar 18 15:47:34 2003
+++ shadow/39920.tmp.31492	Tue Mar 18 15:47:34 2003
@@ -0,0 +1,54 @@
+Bug#: 39920
+Product: Mono/Class Libraries
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: synced_@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Xml is throwing an exception where .NET just returns null
+
+Basically I'm in the process of porting a jabber library to mono and I've 
+found a bug in System.Xml, I'm not exactly sure how to explain the 
+problem but basically mono is throwing an exception instead of returning 
+null, which is the desired result.  .NET just returns a null XmlElement 
+in this test case whereas mono throws an exception.
+
+XmlDocument doc = new XmlDocument();
+XmlElement tmpXML;
+
+doc.LoadXml("<iq id='JN_2' type='result' />");
+try 
+{
+    tmpXML = (XmlElement)doc.GetElementsByTagName("query")[0]; 
+    if (tmpXML == null)
+    {
+        Console.WriteLine("This is the desired result.");
+    }
+}
+catch (Exception e)
+{
+    Console.WriteLine(e.Message + "\n\nThis is not the desired result.");
+}
+Console.ReadLine();
+
+Actual Results:
+Throws an exception
+Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out 
+of range
+
+Expected Results:
+Return null.  Tested on .NET, and it returns null.
+
+How often does this happen? 
+Every time.
+
+Additional Information: