So, I had my project working fine. However, after I cleaned it and rebuilt it, the configurationManager stopped working. Indeed, when debugging, I can see that ConfigurationManager.AppSettings
has no entries, when before it had four.
I'm guessing the configurationManager is not looking for the file it should be looking, which most likely was deleted during the clean. Is there any way to know where it is searching for config entries?
Edit: So, I took a look with Procmon and it seems it is searching the correct config file, in the same folder as the executable. The file looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Subtitle_Synchronizer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<Subtitle_Synchronizer.Properties.Settings>
<setting name="AegisubPath" serializeAs="String">
<value />
</setting>
<setting name="CheckActors" serializeAs="String">
<value>False</value>
</setting>
<setting name="PostProcessSubs" serializeAs="String">
<value>False</value>
</setting>
<setting name="WorkingFolderPath" serializeAs="String">
<value>c:\</value>
</setting>
</Subtitle_Synchronizer.Properties.Settings>
</userSettings>
</configuration>
So, I kinda solved it, although it doesn't make any sense. If I run without debugging, it gives the exception. But after that, the problem is "solved", and configurationManager works correctly. If I rebuild the solution, the problem comes again, but is solved again with that method. The hell.
Edit: Figured out a little more. So, it seems that the config file regenerates AFTER throwing the exception when running without debugging. It adds the following to the config file: