title: VerificationException Operation could destabilize the runtime on Simple LINQ Query
body: <p>Here's the problem. The code below works fine on my development PC, but when I deployed the app, it crashes.</p>
  
  <p>Here is the lines of code that are relvant</p>
  
  <pre><code>Private TdsTypesList As List(Of TDS_Type)
  </code></pre>
  
  <p>...</p>
  
  <pre><code>TdsTypesList = (From tt In db.TDS_Types Select tt).ToList
  </code></pre>
  
  <p>This is the error I get</p>
  
  <blockquote>
    <p>Exception Source: Anonymously Hosted DynamicMethods Assembly
    Exception Type: System.Security.VerificationException
    Exception Message: Operation could destabilize the runtime. 
    Exception Target Site: Read_TDS_Type Object reference not set to >an instance of an object.</p>
  </blockquote>
  
  <p>I have many queries that are using linq, and none of them throw any errors. The set of data is not very large either, less that 100 rows. I dont know if I have any other queries that do not have where statements in them that work.</p>
  
  <p>Running .net 3.5 without sp1 on the client machine, although I am running sp1 on my development PC. looking for a solution that doesn't require sp1 to be installed.</p>
  
  <p><strong>Edit</strong>
  Code breaks on the second line when remote debugging. </p>
  
  <p>I looked over <a href="https://stackoverflow.com/questions/378895/operation-could-destabilize-the-runtime">Operation could destabilize the runtime?</a>
   and tried the following, with the same error.</p>
  
  <pre><code>  TdsTypesList = tl.OfType(Of TDS_Type)().ToList
  </code></pre>
  
  <p>I finally found a dirty workaround. Instead of pulling all of columns from that table, I was able to re-write the query to omit 1 column. This returns an object of anonymous type, and I can use that object. I still would like to know what causes this though. </p>