diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs index 7be0ee4163fdd1..583a1330fb530e 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/ClientConfigPaths.cs @@ -68,7 +68,10 @@ private ClientConfigPaths(string exePath, bool includeUserConfig) { // An EntryAssembly may not be found when running from a custom host. // Try to find the native entry point. - ApplicationUri = Process.GetCurrentProcess().MainModule.FileName; + using (Process currentProcess = Process.GetCurrentProcess()) + { + ApplicationUri = currentProcess.MainModule.FileName; + } } }