From 2709c912f007a063f523c0754ef6a5f9ce37b137 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 2 Jul 2008 00:28:35 +0000 Subject: [PATCH] 2008-07-01 Miguel de Icaza * ConfigurationManager.cs (OpenExeConfigurationInternal): if the string passed is empty, then we default to the startup assembly. Fixes: #405574 Not entirely happy as there is no decent documentation for this behavior (the docs state nothing about empty strings). svn path=/trunk/mcs/; revision=107019 --- mcs/class/System.Configuration/ChangeLog | 10 ++++++++++ .../System.Configuration/ConfigurationManager.cs | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/mcs/class/System.Configuration/ChangeLog b/mcs/class/System.Configuration/ChangeLog index cbd20a1b730..2f27439f243 100644 --- a/mcs/class/System.Configuration/ChangeLog +++ b/mcs/class/System.Configuration/ChangeLog @@ -1,3 +1,13 @@ +2008-07-01 Miguel de Icaza + + * ConfigurationManager.cs (OpenExeConfigurationInternal): if the + string passed is empty, then we default to the startup assembly. + + Fixes: #405574 + + Not entirely happy as there is no decent documentation for this + behavior (the docs state nothing about empty strings). + 2008-06-26 Gert Driesen * System.Configuration_test.dll.sources: added diff --git a/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs b/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs index 0d5768e7e36..8feccee0df0 100644 --- a/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs +++ b/mcs/class/System.Configuration/System.Configuration/ConfigurationManager.cs @@ -95,9 +95,13 @@ namespace System.Configuration { switch (userLevel) { case ConfigurationUserLevel.None: - if (exePath == null) - exePath = calling_assembly.Location; - else if (!File.Exists (exePath)) + if (exePath == null || exePath == ""){ + Assembly a = Assembly.GetEntryAssembly (); + if (a == null) + a = calling_assembly; + + exePath = a.Location; + } else if (!File.Exists (exePath)) exePath = ""; if (exePath != "") { -- 2.25.1