title: An unhandled exception of type 'System.TypeInitializationException' occurred in System.dll
body: <p>My visual basic application (targeting Framework 4) was running perfectly until I added code that was originally targeted for Framework 2.0 (specifically altering the column headers of a datagridview).  The code executed without problem the first time (when debugging), and thereafter my application won't start.  I deleted all the newly added code and debugged, but the errors stayed.  I even loaded my backup into Visual Studio, but no change.</p>
  
  <p>I get the following errors and have no idea where to find the source of this problem: </p>
  
  <blockquote>
    <p>First-chance exception at 0x77cd708f in "app.name".exe: 0xC0000008: An
    invalid handle was specified.  An unhandled exception of type
    'System.TypeInitializationException' occurred in System.dll.
    Additional information: The type initializer for 'System.Net.ComNetOS'
    threw an exception.</p>
  </blockquote>
  
  <p>I re-installed Visual Studio and Framework 4.  I googled the errors, but nothing pointed me to the location causing the error. I don't believe it's in my code, because I built in try/catch blocks from the very start of the code, even using application events 'startup' and 'unhandledexception', but the app doesn't even start that I may catch the exception stacktrace.</p>
  
  <p>Visual Studio indicates that no symbols are loaded for call stack frame and no source is available. I'm not aware of an error log that might provide details.</p>
  
  <p>Hope someone can help.</p>