title: Can I specify a range with the IntegerValidator attribute on a custom ConfigurationSection?
body: <p>I have a class containing the following <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.aspx" rel="noreferrer">ConfigurationSection</a>:</p>
  
  <pre><code>namespace DummyConsole {
    class TestingComponentSettings: ConfigurationSection {
  
      [ConfigurationProperty("waitForTimeSeconds", IsRequired=true)]
      [IntegerValidator(MinValue = 1, MaxValue = 100, ExcludeRange = false)]
      public int WaitForTimeSeconds
      {
          get { return (int)this["waitForTimeSeconds"]; }
          set { this["waitForTimeSeconds"] = value; }
      }
  
      [ConfigurationProperty("loginPage", IsRequired = true, IsKey=false)]
      public string LoginPage
      {
          get { return (string)this["loginPage"]; }
          set { this["loginPage"] = value; }
      }
    }
  }
  </code></pre>
  
  <p>I then have the following in my .config file:</p>
  
  <pre><code>&lt;configSections&gt;
    &lt;section name="TestingComponentSettings" 
             type="DummyConsole.TestingComponentSettings, DummyConsole"/&gt;
  &lt;/configSections&gt;
  &lt;TestingComponentSettings waitForTimeSeconds="20" loginPage="myPage" /&gt;
  </code></pre>
  
  <p>When I then attempt to use this configuration section I get the following error:</p>
  
  <pre><code>var Testing = ConfigurationManager.GetSection("TestingComponentSettings")
               as TestingComponentSettings;
  </code></pre>
  
  <blockquote>
    <p><strong>ConfigurationErrorsException was unhandled</strong></p>
    
    <p>The value for the property 'waitForTimeSeconds' is not valid. The error is: The value must be inside the range 1-100.</p>
  </blockquote>
  
  <p>If I change the <code>IntegerValidator</code> to have an ExcludeRage = true, I (obviously) get:</p>
  
  <blockquote>
    <p><strong>ConfigurationErrorsException was unhandled</strong></p>
    
    <p>The value for the property 'waitForTimeSeconds' is not valid. The error is: The value must not be in the range 1-100</p>
  </blockquote>
  
  <p>If I then change the value of the property in the .config to a number higher than 100, it works.</p>
  
  <p>If I change the validator to just have a <code>MaxValue</code> of 100 it works, but will also accept a value of -1.</p>
  
  <p>Is it possible to use the <code>IntegerValidatorAttribute</code> with a range like this?</p>
  
  <p><strong>Edit to add</strong></p>
  
  <p>Confirmed as an <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=526491" rel="noreferrer">issue by Microsoft</a>.</p>