title: ConfigurationProperty is inaccessible due to its protection level
body: <p>I wanna <strong>read/write (and save)</strong> application's configuration file in program</p>
  
  <p>The app.config is like this:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="AdWordsApi" type="System.Configuration.DictionarySectionHandler" requirePermission="false"/&gt;
    &lt;/configSections&gt;
    &lt;AdWordsApi&gt;
      &lt;add key="LogPath" value=".\Logs\"/&gt;
      ...
    &lt;/AdWordsApi&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When I use <strong>ConfigurationManager.GetSection</strong> to read the app.config, it works:</p>
  
  <pre><code>var adwords_section = (System.Collections.Hashtable) System.Configuration.ConfigurationManager.GetSection("AdWordsApi");
  Console.WriteLine((string)adwords_section["LogPath"]);
  </code></pre>
  
  <p>But when I use <strong>ConfigurationManager.OpenExeConfiguration</strong>:</p>
  
  <pre><code>Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
  ConfigurationSection section = config.GetSection("AdWordsApi");
  Console.WriteLine(section["LogPath"]);
  </code></pre>
  
  <p>I always get this error:</p>
  
  <blockquote>
    <p>'System.Configuration.ConfigurationElement.this[System.Configuration.ConfigurationProperty]'
    is inaccessible due to its protection level</p>
  </blockquote>
  
  <p>But as I know, <strong>GetSection</strong> cannot save configuration at program runtime, Like I said at beginning: I wanna save configuration at program runtime, So I have to use <strong>OpenExeConfiguration</strong>.</p>
  
  <p>I have googled for long time, what I found is to use AppSettings, but what I use is custom section..</p>
  
  <p>Anyone could explain why this "ConfigurationProperty is inaccessible" error occured? Thanks</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>I have set <strong>copy local</strong> of <em>System</em> and <em>System.Configuration</em> to <strong>true</strong></p>