Author: mhabersack
Date: 2007-06-12 18:26:08 -0400 (Tue, 12 Jun 2007)
New Revision: 79348

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
Log:
2007-06-13  Marek Habersack  <[EMAIL PROTECTED]>

        * TemplateControlCompiler.cs: make sure control has a writable
        TemplateControl property prior to assigning values to it.


Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-06-12 
22:11:27 UTC (rev 79347)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-06-12 
22:26:08 UTC (rev 79348)
@@ -1,3 +1,8 @@
+2007-06-13  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * TemplateControlCompiler.cs: make sure control has a writable
+       TemplateControl property prior to assigning values to it.
+
 2007-06-09  Marek Habersack  <[EMAIL PROTECTED]>
 
        * TemplateControlCompiler.cs: TemplateControl is assigned for

Modified: 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs    
    2007-06-12 22:11:27 UTC (rev 79347)
+++ 
trunk/mcs/class/System.Web/System.Web.Compilation/TemplateControlCompiler.cs    
    2007-06-12 22:26:08 UTC (rev 79348)
@@ -249,12 +249,21 @@
 
 #if NET_2_0
                                if (builder.ParentTemplateBuilder is 
System.Web.UI.WebControls.ContentBuilderInternal) {
-                                       // __ctrl.TemplateControl = this;
-                                       assign = new CodeAssignStatement ();
-                                       assign.Left = new 
CodePropertyReferenceExpression (ctrlVar, "TemplateControl");;
-                                       assign.Right = thisRef;
-                                       
-                                       method.Statements.Add (assign);
+                                       PropertyInfo pi;
+
+                                       try {
+                                               pi = type.GetProperty 
("TemplateControl");
+                                       } catch (Exception) {
+                                               pi = null;
+                                       }
+
+                                       if (pi != null && pi.CanWrite) {
+                                               // __ctrl.TemplateControl = 
this;
+                                               assign = new 
CodeAssignStatement ();
+                                               assign.Left = new 
CodePropertyReferenceExpression (ctrlVar, "TemplateControl");;
+                                               assign.Right = thisRef;
+                                               method.Statements.Add (assign);
+                                       }
                                }
                                
                                // _ctrl.SkinID = $value

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to