title: Why would this line throw exception for type initializer failed?
body: <p>I had a class:</p>
  
  <pre><code>public class Constant
  {
  
      public static string ConnString = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
  }
  </code></pre>
  
  <p>which would throw exception on LIVE: Type initialize failed for Constant ctor</p>
  
  <p>If I change the class to:</p>
  
  <pre><code>public class Constant
  {
      public static string ConnString
      {
          get
          {
              return ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
          }
      }
  }
  </code></pre>
  
  <p>it works. I wasted 2 hours behind this but I still don't know why would this happen. Any ideas?</p>
  
  <p><strong>Note:</strong> The 1st class used to work on DEV environment but not on LIVE. The 2nd class works on DEV and also on Production.</p>
  
  <p>I am using VS2010 on production and Asp.Net 4.0 Website project.</p>
  
  <p>I am totally amazed by this inconsistency to say the least!</p>
  
  <p><strong>Edit:</strong> This class was in <code>App_Code</code> folder.</p>