[Mono-bugs] [Bug 59679][Blo] New - Mono Beta 2 bug with ASP.NET Tracing and NULL message value.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 7 Jun 2004 01:49:29 -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 davidandrewtaylor@hotmail.com.

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

--- shadow/59679	2004-06-07 01:49:29.000000000 -0400
+++ shadow/59679.tmp.4999	2004-06-07 01:49:29.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 59679
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 001 One hour
+Priority: Blocker
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono Beta 2 bug with ASP.NET Tracing and NULL message value.
+
+I have found a bug in Mono (tested in Beta 2) when tracing is enabled 
+outputting to the page.  The bug causes ASP.NET to throw an exception (so 
+my appliation will not run with tracing enabled).
+
+Please fix this bug by editing the file: "TraceData.cs" and making the 
+following change:
+Line 117: r ["Message"] = msg;
+needs to be replaced with:
+Line 117: r ["Message"] = (msg != null) ? msg : String.Empty;
+
+Note: While you are at it, you might as well make the equivalent change 
+to the "Category" line 116 (although this is not causing me a problem).
+
+Additional Information:
+I am using one of the .NET 1.1 page templating solutions (like 
+MasterPages) which overrides the Page OnInit method and dynamically loads 
+a .ASCX template, and then injects all the controls on the main page 
+inside the template.  While this works perfectly on .NET, when run on 
+MONO with traceing enabled I get this:
+
+System.InvalidCastException: Cannot cast from source type to destination 
+type.
+in <0x0024e> System.Web.TraceData:RenderTraceInfoRow 
+(System.Web.UI.WebControls.Table,System.Data.DataRow,int)
+in <0x001b7> System.Web.TraceData:RenderTraceInfo 
+(System.Web.UI.HtmlTextWriter)
+in <0x00084> System.Web.TraceData:Render (System.Web.UI.HtmlTextWriter)
+in <0x0002e> System.Web.TraceContext:Render (System.Web.UI.HtmlTextWriter)
+in <0x000cc> System.Web.UI.Page:RenderTrace (System.Web.UI.HtmlTextWriter)
+in <0x0043f> System.Web.UI.Page:InternalProcessRequest ()
+in <0x0008d> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)
+in <0x002e8> ExecuteHandlerState:Execute ()
+in <0x00084> StateMachine:ExecuteState 
+(System.Web.HttpApplication/IStateHandler,bool&)
+
+Upon further investigation this error is occuring because the trace 
+message is NULL and thus line 117 (above) is just setting r["Message"] to 
+null (DBNull actually). 
+** In the private method:
+private TableRow RenderTraceInfoRow (Table table, DataRow r, int pos) {
+** The very last line is throwing an exception:
+return RenderAltRow (table, pos, open + (string) r ["Category"] + close, 
+open + (string) r ["Message"] + close, t1, t2);
+** The exception is thrown because r["Message"] is returning 
+type "DBNull" which cannot be cast to "String".
+
+This bug could obviously also be fixed by doing an extra check inside the 
+RenderTraceInfoRow to make sure the message has a value, such as r.IsNull
+("Message").  But the easiest fix is probably just to change line 117 as 
+I have described above.
+
+After making this change, the trace output appears exactly as it should 
+(and as it does with MS.NET) in that a line appears with no Category and 
+no Message, but showing the last 2 fields ("From First" and "From Last").
+
+I am sorry I have not posted a sample testcase, but this error is 
+happening deep within my corporate application and I have not had time 
+to "extract" this into a standalone testcase yet.  I would much 
+appreciate this line being change to fix the bug after which I will 
+checkout the latest version in CVS and verify and close the bug report.  
+It would be great to have this fixed for Beta 3.
+
+Thanks,
+David Taylor