* ConfigurationSettings.cs: Avoid chicken-egg problem when reading machine.config.
authorLluis Sanchez <lluis@novell.com>
Mon, 16 Jun 2003 22:25:36 +0000 (22:25 -0000)
committerLluis Sanchez <lluis@novell.com>
Mon, 16 Jun 2003 22:25:36 +0000 (22:25 -0000)
  Cannot use an uri to read mechine.config because web request module handelrs are
  defined in machine.config.

svn path=/trunk/mcs/; revision=15446

mcs/class/System/System.Configuration/ChangeLog
mcs/class/System/System.Configuration/ConfigurationSettings.cs

index a6de6c7fb6a5646d0a85af36fccd6178f882818b..6a569e6c800703459ddef53e2f5ff3ba53b1001f 100644 (file)
@@ -1,3 +1,9 @@
+2003-06-16  Lluis Sanchez Gual <lluis@ximian.com>
+
+       * ConfigurationSettings.cs: Avoid chicken-egg problem when reading machine.config.
+         Cannot use an uri to read mechine.config because web request module handelrs are
+         defined in machine.config.
+
 2003-03-02  Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * AppSettingsReader.cs: fixed bug #38755.
index b9c3b963acbeed984fac99f12d9dcacda2cfb1c4..bb8a00ceb40dfba741a9edc74fe760bcd954042e 100644 (file)
@@ -157,11 +157,12 @@ namespace System.Configuration
 
                        try {
                                try {
-                                       reader = new XmlTextReader (fileName);
-                               } catch {
+                                       FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+                                       reader = new XmlTextReader (fs);
+                               } catch (Exception ex) {
                                        return false;
                                }
-                               
+
                                InitRead (reader);
                                ReadConfigFile (reader);
                        } finally {
@@ -207,7 +208,8 @@ namespace System.Configuration
                {
                        XmlTextReader reader = null;
                        try {
-                               reader = new XmlTextReader (fileName);
+                               FileStream fs = new FileStream (fileName, FileMode.Open, FileAccess.Read);
+                               reader = new XmlTextReader (fs);
                        } catch {
                                return null;
                        }