[Mono-bugs] [Bug 58867][Cri] New - XmlNode.Normalize Method throws exception

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 23 May 2004 01:16:19 -0400 (EDT)


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 consulatewizard@yahoo.co.nz.

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

--- shadow/58867	2004-05-23 01:16:19.000000000 -0400
+++ shadow/58867.tmp.15906	2004-05-23 01:16:19.000000000 -0400
@@ -0,0 +1,48 @@
+Bug#: 58867
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Critical
+Component: Sys.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: consulatewizard@yahoo.co.nz               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlNode.Normalize Method throws exception
+
+Description of Problem:
+
+XmlNode.Normalize throws System.NullReferenceException.
+
+Code Fragment that calls the above mentioned method:
+
+XmlDocument doc = new XmlDocument();
+doc.PreserveWhitespace = true;
+try {
+  doc.LoadXml(/* some string containing an XML fragment */);
+} catch ( XmlException ex ) {
+  Console.WriteLine(ex);
+  return;
+}
+XmlNode node = doc.DocumentElement;
+node.Normalize();
+
+Resulting stack trace:
+
+Unhandled Exception: System.NullReferenceException: Object reference not 
+set to an instance of an object
+in <0x00190> System.Xml.XmlNode:NormalizeRange (int,int)
+in <0x0010d> System.Xml.XmlNode:Normalize ()
+in <0x000f8> System.Xml.XmlNode:Normalize ()
+in <0x0052c> SharpAlice.Graphmaster:Respond (string,string,bool)
+in <0x0010b> Console.Class1:Main (string[])
+
+Example XML string passed to XmlDocument:LoadXml():
+
+"<template><learn><star index='2'/>.<star/></learn></template>"