[Mono-bugs] [Bug 81335][Nor] New - some control events are not fired (i.e. LoginStatus.LoggedOut) [w/ fix]
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Apr 8 00:15:51 EDT 2007
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 mmorano at mikeandwan.us.
http://bugzilla.ximian.com/show_bug.cgi?id=81335
--- shadow/81335 2007-04-08 00:15:51.000000000 -0400
+++ shadow/81335.tmp.7555 2007-04-08 00:15:51.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 81335
+Product: Mono: Class Libraries
+Version: 1.2
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Web
+AssignedTo: mhabersack at novell.com
+ReportedBy: mmorano at mikeandwan.us
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: some control events are not fired (i.e. LoginStatus.LoggedOut) [w/ fix]
+
+When trying to hook into the LoggedOut event of the LoginStatus control, I
+noticed that the method that was registered via the ascx was never called.
+ I looked at the disassembled version of the generated class, and noticed
+it was trying to do a "SetAttribute" on an IAttributeAccessor, rather than
+trying to register for the event.
+
+I traced this down to the TemplateControlCompiler, and the section of code
+that deals with event registration appears a bit weak, Previously, checked
+to see if the attribute name started with "on" to determine if it was an
+event registration. Well, for the LoginStatus, the attribute is
+"LoggedOut", and not "OnLoggedOut", hence the event was not properly
+registered.
+
+Honestly, am not sure what the proper fix is for this, but the following
+does fix the LoginStatus.LoggedOut registration, and should be generic
+enough to solve other cases. It leaves the "on" check in place, though it
+seems that there should be a better way to handle that.
+
+Anyways, here is the patch that adds an extra check to see if the id is for
+an event, while leaving the existing check in place:
+
+
+Index: System.Web.Compilation/TemplateControlCompiler.cs
+===================================================================
+--- System.Web.Compilation/TemplateControlCompiler.cs (revision 75493)
++++ System.Web.Compilation/TemplateControlCompiler.cs (working copy)
+@@ -802,11 +802,19 @@
+ Type type = builder.ControlType;
+
+ string attvalue = builder.attribs [id] as string;
+- if (id.Length > 2 && id.Substring (0, 2).ToUpper ()
+== "ON"){
++
++ EventInfo evMember = type.GetEvent(id);
++ if ((id.Length > 2 && id.Substring (0, 2).ToUpper
+() == "ON") || (evMember != null)){
+ if (ev_info == null)
+ ev_info = type.GetEvents ();
+
+ string id_as_event = id.Substring (2);
++
++ if(evMember != null)
++ {
++ id_as_event = id;
++ }
++
+ foreach (EventInfo ev in ev_info){
+ if (InvariantCompareNoCase
+(ev.Name, id_as_event)){
+ AddEventAssign (builder.method,
More information about the mono-bugs
mailing list