[Mono-bugs] [Bug 55245][Min] New - NullReferenceException using Repeater

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 5 Mar 2004 19:08:27 -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 gonzalo@ximian.com.

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

--- shadow/55245	2004-03-05 19:08:27.000000000 -0500
+++ shadow/55245.tmp.18670	2004-03-05 19:08:27.000000000 -0500
@@ -0,0 +1,87 @@
+Bug#: 55245
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Minor
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: gonzalo@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException using Repeater
+
+(mail from mono-list by Simon Cunningham <simon@pangomedia.com>)
+ystem.NullReferenceException: A null value was found where an object 
+instance was required
+in <0x0007e> System.Web.UI.TemplateControl:GetTypeFromControlPath (string)
+in <0x0001d> System.Web.UI.TemplateControl:LoadTemplate (string)
+in <0x00356> Pangomedia.Sitechunk.Page:Render 
+(System.Web.UI.HtmlTextWriter)
+in <0x0001c> System.Web.UI.Control:RenderControl 
+(System.Web.UI.HtmlTextWriter)
+in <0x000de> System.Web.UI.Control:RenderChildren 
+(System.Web.UI.HtmlTextWriter)
+in <0x00011> System.Web.UI.Control:Render (System.Web.UI.HtmlTextWriter)
+in <0x0344e> Pangomedia.Sitechunk.Controller:Render 
+(System.Web.UI.HtmlTextWriter)
+in <0x0001c> System.Web.UI.Control:RenderControl 
+(System.Web.UI.HtmlTextWriter)
+in <0x000de> System.Web.UI.Control:RenderChildren 
+(System.Web.UI.HtmlTextWriter)
+in <0x00011> System.Web.UI.Control:Render (System.Web.UI.HtmlTextWriter)
+in <0x0001c> System.Web.UI.Control:RenderControl 
+(System.Web.UI.HtmlTextWriter)
+in <0x0041f> System.Web.UI.Page:InternalProcessRequest ()
+in <0x0008f> System.Web.UI.Page:ProcessRequest (System.Web.HttpContext)
+in <0x00186> .ExecuteHandlerState:Execute ()
+in <0x00084> .StateMachine:ExecuteState 
+(System.Web.HttpApplication/IStateHandler,bool&)
+ 
+It appears that System.Web.UI.TemplateControl.GetTypeFromControlPath is 
+returning a null value (called from LoadTemplate()).
+ 
+Here is the code used:
+ 
+foo.aspx:
+<%@ Page validateRequest="false" language="C#" Debug="true" %>
+<%@ register tagprefix="MN" namespace="My.Namespace" assembly="Foo" %>
+<MN:Foo id="some_id" runat="server" />
+ 
+Foo.cs:
+using System;
+using System.Collections;
+using System.Web;
+using System.Web.UI.WebControls;
+                           
+namespace My.Namespace {
+   public class Foo: System.Web.UI.Page {
+      System.Web.UI.HtmlTextWriter writer;
+      public Foo() {
+        ArrayList list = new ArrayList();
+        list.Add("foo");
+        Repeater rpt = new Repeater();
+        rpt.ItemTemplate = LoadTemplate("bar.ascx");
+        rpt.DataSource = list;
+        rpt.DataBind();
+        Controls.Add(rpt);
+        base.Render(writer);
+      }
+   }
+}
+                                                                        
+         
+bar.ascx
+<%@ Control Language="C#" %>
+<html>
+<head>
+</head>
+<body>
+This is bar.ascx
+</body>
+</html>