title: What can be the reason that I get TypeInitializationException when I call a static method on a class?
body: <p>I have a static method on a public class. Example:</p>
  
  <pre><code>public class MyClass {
   public static bool Test() { return true; }
  }
  </code></pre>
  
  <p>And I call this from a unit test in another class:</p>
  
  <pre><code>MyClass.Test();
  </code></pre>
  
  <p>When the debugger comes to this it throws: TypeInitializationException:</p>
  
  <blockquote>
    <p>{"The type initializer for 'Xxxxx.Yyyyy.MyClass' threw an exception."}</p>
  </blockquote>
  
  <p>Inner Exception says: </p>
  
  <blockquote>
    <p>{"Value cannot be null.\r\nParameter name: container"}</p>
  </blockquote>
  
  <p>Any idea why it may be the case?</p>
  
  <p>Note: This is a class in a console application - if it is important.</p>