[Mono-bugs] [Bug 58686][Nor] New - MONO Beta 1 Bug: WebControlsConfig must implement IDictionary

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 19 May 2004 03:29:20 -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=58686

--- shadow/58686	2004-05-19 03:29:20.000000000 -0400
+++ shadow/58686.tmp.2060	2004-05-19 03:29:20.000000000 -0400
@@ -0,0 +1,102 @@
+Bug#: 58686
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 004 Four hours
+Priority: Normal
+Component: Sys.Web
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: davidandrewtaylor@hotmail.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Summary: MONO Beta 1 Bug: WebControlsConfig must implement IDictionary
+
+Description of Problem:
+MS.NET and MONO implement a ConfigurationSettings.GetConfig and a 
+Context.GetConfig method which is an implementation of the 
+System.Configuration.IConfigurationSystem interface.  These are both 
+PUBLIC methods and the returned object (at least from 
+ConfigurationSettings.GetConfig is very well documented).
+
+Note there is much public documentation stating the returned object 
+should implement IDictionary or be a NameValueCollection, or to be exact 
+from the SDK: "The configuration system returns a 
+System.Collections.IDictionary object when you call 
+ConfigurationSettings.GetConfig"..."The following table shows the type of 
+object the ConfigurationSettings.GetConfig method returns for each 
+configuration section handler.  DictionarySectionHandler returns  
+Systems.Collections.IDictionary.   NameValueSectionHandler returns 
+Systems.Collections.Specialized.NameValueCollection"
+
+SDK References are below:
+http://msdn.microsoft.com/library/default.asp?url=/library/en-
+us/cpguide/html/cpcondeclaringcustomconfigurationsections.asp
+http://msdn.microsoft.com/library/default.asp?url=/library/en-
+us/cpgenref/html/gngrfcustomelementforsingletagsectionhandler.asp
+http://msdn.microsoft.com/library/default.asp?url=/library/en-
+us/cpgenref/html/gngrfcustomelementfornamevaluesectionhandlerdictionarysec
+tionhandler.asp
+
+Steps to reproduce the problem:
+<%@Page language="c#" Trace="False" %>
+<%
+	Response.Write("Testing Context.GetConfig(string)<br>");
+	object o = Context.GetConfig("system.web/webControls");
+        Response.Write("Type was: " + o.GetType() + "<br>");
+        if (o is System.Collections.IDictionary) 
+             Response.Write("Type DOES implement IDictionary<br><br>");
+        else Response.Write("Type Does NOT implement 
+IDictionary<br><br>");
+	Response.Write("TestingConfigurationSettings.GetConfig(string)
+<br>");
+    	object o2 = System.Configuration.ConfigurationSettings.GetConfig
+("system.web/webControls");
+    	Response.Write("Type was: " + o.GetType() + "<br>");
+        if (o2 is System.Collections.IDictionary) 
+             Response.Write("Type DOES implement IDictionary");
+        else Response.Write("Type Does NOT implement IDictionary");
+%>
+
+Actual Results:
+MONO Beta 1:
+Testing Context.GetConfig(string)
+Type was: System.Web.Configuration.WebControlsConfig
+Type Does NOT implement IDictionary
+
+TestingConfigurationSettings.GetConfig(string)
+Type was: System.Web.Configuration.WebControlsConfig
+Type Does NOT implement IDictionary
+
+Expected Results:
+MS.NET:
+Testing Context.GetConfig(string)
+Type was: System.Collections.Hashtable
+Type DOES implement IDictionary
+
+TestingConfigurationSettings.GetConfig(string)
+Type was: System.Collections.Hashtable
+Type DOES implement IDictionary
+
+How often does this happen? 
+All the time using ASP.NET on MONO Beta 1.
+
+Additional Information:
+For maximum compatibility it would appear a Hashtable should be returned 
+as a short Google search showed a number of code examples where some 
+buggy programs "Assumed" a hashtable (which MS.NET returns).
+
+However to be compliant with the SDK the current object being return MUST 
+implement IDictionary (Note that Hashtable implements IDictionary).
+
+Note that I found this bug when using a very popular component called the 
+XmlEditGrid which inherits from the DataGrid and allows automatic editing 
+of basic XML Documents (the component was released in Jan 2002 and is 
+used in a number of ASP.NET apps).  This particular component cast the 
+returned object to an IDictionary and by fixing this bug in MONO we will 
+fix the issue.
+
+Final Comment: Gonzalo makes me work hard for his affections :-)