c# - ConfigurationManager.OpenMappedExeConfiguration problematic behaviour -


I have a very strange problem with my WPF application. I try to open a regular config file using this method I am:

  ExeConfigurationFileMap filemap = new ExeConfigurationFileMap (); FileMap.ExeConfigFilename = ConfigurationManager.AppSettings [PATH_TO_CONFIG]; // which returns a valid path s_config = ConfigurationManager.OpenMappedExeConfiguration (fileMap, ConfigurationUserLevel.None);  

When you run the application for the first time, it works fine - it's F. Finds the config file in directory in the xi residence - D: \ MyApp \ bin \ Debug \ MyConfigFile.conf But when you choose to open new instances from the context menu, right-clicking on the app icon running in the toolbar, and then you open a new instance. Strange behavior: s_config.FilePath is no longer searching my config file, because it points to "C: \ Windows \ systems32 \ myConfigFile.exe.config" and this problem only renders when another application starts this way it happens. / P>

Does anyone have an idea of ​​what the problem might be?

We did not find a solution to the problem, so we worked around it. If the config file is not found, then we used the system. Reflection.Assembly.GetExecutingAssembly () Location File - FileMap.ExeConfigFilename

to get the full path to the config file

Comments