Browse Source

2007-06-18 Atsushi Enomoto <[email protected]>

        * ClientConfigurationSystem.cs : do not asume GetEntryAssembly()
          returns non-null. Patch by Patrick Perry.


svn path=/trunk/mcs/; revision=79983
Atsushi Eno 18 years ago
parent
commit
a55800e705

+ 5 - 0
mcs/class/System.Configuration/System.Configuration/ChangeLog

@@ -1,3 +1,8 @@
+2007-06-18  Atsushi Enomoto  <[email protected]>
+
+	* ClientConfigurationSystem.cs : do not asume GetEntryAssembly()
+	  returns non-null. Patch by Patrick Perry.
+
 2007-06-13  Atsushi Enomoto  <[email protected]>
 
 	* ConfigurationElement.cs : SerializeToXmlElement() should be

+ 8 - 3
mcs/class/System.Configuration/System.Configuration/ClientConfigurationSystem.cs

@@ -39,9 +39,14 @@ namespace System.Configuration {
 		object IInternalConfigSystem.GetSection (string configKey)
 		{
 			Assembly a = Assembly.GetEntryAssembly();
-
-			Configuration cfg = ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel.None, a, AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
-			if (cfg == null) return null;
+			string exePath = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
+            
+			if (a == null && exePath == null)
+				exePath = "";
+            
+			Configuration cfg = ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel.None, a, exePath);
+			if (cfg == null)
+				return null;
 
 			ConfigurationSection s = cfg.GetSection (configKey);
 			return s != null ? s.GetRuntimeObject () : null;