[Mono-bugs] [Bug 75375][Nor] Changed - .Expresion does not evaluate expresion properly

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Jun 29 07:45:46 EDT 2005


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

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

--- shadow/75375	2005-06-24 21:19:13.000000000 -0400
+++ shadow/75375.tmp.21009	2005-06-29 07:45:46.000000000 -0400
@@ -0,0 +1,184 @@
+Bug#: 75375
+Product: Mono: Class Libraries
+Version: 1.1
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.Data
+AssignedTo: tsureshkumar at novell.com                            
+ReportedBy: marcelo.iturbe at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Summary: .Expresion does not evaluate expresion properly
+
+Description of Problem:
+I have a mathematical expresion such as 
+dt.Columns["result"].Expression = "column1*column2/100";
+This line itself does not crash, but at the moment I try to read the value
+evalueated in "result" it throughs the following error:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+Under windows (with .net) this works. Have not tried mono+windows.
+
+Steps to reproduce the problem:
+1. mcs -r:System.Data class1.cs
+2. mono class1.exe
+
+Actual Results:
+Col1 "80"
+Col2 "10"
+result "8"
+Col1 "6"
+Col2 ""
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00026> Mono.Data.SqlExpressions.Numeric:ToSameType (IConvertible o1,
+IConvertible o2)
+in <0x00015> Mono.Data.SqlExpressions.Numeric:Multiply (IConvertible o1,
+IConvertible o2)
+in <0x0023f> Mono.Data.SqlExpressions.ArithmeticOperation:Eval
+(System.Data.DataRow row)
+in <0x00038> Mono.Data.SqlExpressions.ArithmeticOperation:Eval
+(System.Data.DataRow row)
+in <0x000e8> System.Data.DataRow:get_Item (Int32 columnIndex,
+DataRowVersion version)
+in <0x00043> System.Data.DataRow:get_Item (System.String columnName,
+DataRowVersion version)
+in <0x00015> System.Data.DataRow:get_Item (System.String columnName)
+in <0x002fe> DataTableBug.Class1:Main (System.String[] args)
+
+
+Expected Results:
+Col1 "80"
+Col2 "10"
+result "8"
+Col1 "6"
+Col2 ""
+result ""
+Col1 ""
+Col2 "4"
+result ""
+
+How often does this happen? 
+Always
+
+Additional Information:
+What follows is the content of the class1.cs file, since I did not see any
+link to add a file.
+
+using System;
+using System.Data;
+
+namespace DataTableBug
+{
+	/// <summary>
+	/// Summary description for Class1.
+	/// </summary>
+	class Class1
+	{
+		/// <summary>
+		/// The main entry point for the application.
+		/// </summary>
+		[STAThread]
+		static void Main(string[] args)
+		{
+			DataTable dt = new DataTable();
+			DataRow dr;
+			dt.Columns.Add("column1",System.Type.GetType("System.Int32"));
+			dt.Columns.Add("column2",System.Type.GetType("System.Int32"));
+			dt.Columns.Add("result",System.Type.GetType("System.Int32"));
+			
+			dr = dt.NewRow();
+			dr["column1"] = 80;
+			dr["column2"] = 10;
+			dt.Rows.Add(dr);
+
+			dr = dt.NewRow();
+			dr["column1"] = 6;
+			dt.Rows.Add(dr);
+			
+			dr = dt.NewRow();
+			dr["column2"] = 4;
+			dt.Rows.Add(dr);
+
+			dt.Columns["result"].Expression = "column1*column2/100";
+			
+			foreach(DataRow dr2 in dt.Rows)
+			{
+				Console.WriteLine("Col1 \"" + dr2["column1"].ToString() + "\"");
+				Console.WriteLine("Col2 \"" + dr2["column2"].ToString() + "\"");
+				Console.WriteLine("result \"" + dr2["result"].ToString() + "\"");
+			}
+		}
+	}
+}
+
+------- Additional Comments From marcelo.iturbe at gmail.com  2005-06-24 21:01 -------
+Created an attachment (id=15378)
+test case in c#, simple console app
+
+
+------- Additional Comments From marcelo.iturbe at gmail.com  2005-06-24 21:17 -------
+Created an attachment (id=15379)
+Modified the code to have more debugging. Initial case was too simple
+
+
+------- Additional Comments From marcelo.iturbe at gmail.com  2005-06-24 21:19 -------
+With the new code, this is expected output (this is the output under
+win/.net)
+
+Col1 "80"
+Col2 "10"
+type Int32
+here we go! False
+result "8"
+------------------------------------------
+Col1 "6"
+Col2 ""
+type DBNull
+here we go! True
+nothing to write
+------------------------------------------
+Col1 ""
+Col2 "4"
+type Int32
+here we go! True
+nothing to write
+------------------------------------------
+
+This is the output in debian/mono
+
+Col1 "80"
+Col2 "10"
+type Int32
+here we go! False
+result "8"
+------------------------------------------
+Col1 "6"
+Col2 ""
+type DBNull
+
+Unhandled Exception: System.NullReferenceException: Object reference
+not set to an instance of an object
+in <0x00026> Mono.Data.SqlExpressions.Numeric:ToSameType (IConvertible
+o1, IConvertible o2)
+in <0x00015> Mono.Data.SqlExpressions.Numeric:Multiply (IConvertible
+o1, IConvertible o2)
+in <0x0023f> Mono.Data.SqlExpressions.ArithmeticOperation:Eval
+(System.Data.DataRow row)
+in <0x00038> Mono.Data.SqlExpressions.ArithmeticOperation:Eval
+(System.Data.DataRow row)
+in <0x000e8> System.Data.DataRow:get_Item (Int32 columnIndex,
+DataRowVersion version)
+in <0x00043> System.Data.DataRow:get_Item (System.String columnName,
+DataRowVersion version)
+in <0x00015> System.Data.DataRow:get_Item (System.String columnName)
+in <0x0034f> DataTableBug.Class1:Main (System.String[] args)
+
+Hope this is a bit more helpfull


More information about the mono-bugs mailing list