[Mono-bugs] [Bug 75375][Cri] New - .Expresion does not evaluate expresion properly

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jun 24 20:55:52 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 marcelo.iturbe at gmail.com.

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

--- shadow/75375	2005-06-24 20:55:52.000000000 -0400
+++ shadow/75375.tmp.5173	2005-06-24 20:55:52.000000000 -0400
@@ -0,0 +1,121 @@
+Bug#: 75375
+Product: Mono: Runtime
+Version: 1.1
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Critical
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: marcelo.iturbe at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+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() + "\"");
+			}
+		}
+	}
+}


More information about the mono-bugs mailing list