[Mono-bugs] [Bug 40253][Blo] New - System.IndexOutOfRangeException when using SqlCommand.ExecuteXmlReader()

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 25 Mar 2003 09:11:09 -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 szunyog@sensenet.hu.

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

--- shadow/40253	Tue Mar 25 09:11:09 2003
+++ shadow/40253.tmp.21990	Tue Mar 25 09:11:09 2003
@@ -0,0 +1,86 @@
+Bug#: 40253
+Product: Mono/Class Libraries
+Version: unspecified
+OS: Red Hat 8.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Blocker
+Component: System.Data.SqlClient
+AssignedTo: rodrigo@ximian.com                            
+ReportedBy: szunyog@sensenet.hu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.IndexOutOfRangeException when using SqlCommand.ExecuteXmlReader()
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+System.IndexOutOfRangeException when using SqlCommand.ExecuteXmlReader().
+
+Steps to reproduce the problem:
+1. Create a Console application
+2. Use the following code:
+
+using System;
+using System.Data.SqlClient;
+namespace monodatatest
+{
+	class Class1
+	{
+		[STAThread]
+		static void Main(string[] args)
+		{
+			string sCn = "Persist Security Info=True;Initial 
+Catalog=mydb;Data Source=ai2;Packet Size=4096;User Id=user;PASSWORD=pwd";
+			string sQuery = "select top 1 Data from 
+tblContents for xml auto, elements";
+
+			System.Data.SqlClient.SqlConnection sqlCn = new 
+SqlConnection(sCn);
+			System.Data.SqlClient.SqlCommand sqlCmd = new 
+SqlCommand(sQuery);
+			sqlCn.Open();
+			sqlCmd.Connection = sqlCn;
+
+			System.Xml.XmlReader xr = sqlCmd.ExecuteXmlReader
+();
+			System.Xml.XmlDocument xd = new 
+System.Xml.XmlDocument();
+			if(xr.Read())
+			{
+				xd.Load(xr);
+			}
+			Console.WriteLine(xd.OuterXml);
+			sqlCn.Close();
+			Console.ReadLine();
+		}
+	}
+}
+
+Actual Results:
+Unhandled Exception: System.IndexOutOfRangeException: Array index is out 
+of
+range
+in (unmanaged) mono(mono_raise_exception+0x20) [0x80c1594]
+in (unmanaged) mono(ves_icall_System_String_get_Chars+0x3c) [0x80e38a8]
+in <0x0012d> 00 System.Data.SqlClient.SqlXmlTextReader:Peek ()
+in <0x0002a> 00 System.Xml.XmlTextReader:PeekChar ()
+in <0x0008d> 00 System.Xml.XmlTextReader:ReadContent ()
+in <0x0002b> 00 System.Xml.XmlTextReader:Read ()
+in <0x00080> 00 System.Xml.XmlDocument:ReadNode (System.Xml.XmlReader)
+in <0x00032> 00 System.Xml.XmlDocument:Load (System.Xml.XmlReader)
+in <0x00148> 00 monodatatest.Class1:Main (string[])
+
+Expected Results:
+The content of the data field.
+
+How often does this happen? 
+always
+
+Additional Information:
+mono version: 0.23