title: Why does this line cause a VerificationException when running under .NET 4?
body: <p>Help me out folks - why does this code cause a VerificationException when run under .NET 4.0?</p>
  
  <pre><code>public  T parseEnum&lt;T&gt;(string value, T defaultValue) {
    //Removing the following lines fixes the problem
    if (!typeof(T).IsEnum) throw new ArgumentException("T must be an enumerated type");
    return defaultValue;
  }
  </code></pre>
  
  <p>I ran <code>peverify</code> on the .net 2.0 assembly and got the following message:</p>
  
  <blockquote>
    <p>ImageResizer.Util.Utils::parseEnum[T]][offset 0x0000000A] The 'this' parameter to the call must be the calling method's 'this' parameter.</p>
  </blockquote>
  
  <p>This causes a <code>VerificationException: Operation could destabilize the runtime</code> message when running the code under medium trust.</p>
  
  <p>I've already read all the similar-looking posts on stack overflow, and none of them apply to this code. </p>
  
  <p>Is there something new with generics that would cause this code to be somehow invalid?</p>