title: C# : "A first chance exception of type 'System.InvalidOperationException'"
body: <p>Working on a class assignment in C#, I came across a program crash without any error (except what's written in VS2010's debug window). Here is the typical code causing the crash :</p>
  
  <pre><code>public partial class Test : Form
  {
      public Test()
      {
          InitializeComponent();
      }
  
      private void Test_Load(object sender, EventArgs e)
      {
          ColumnHeader header;
  
          header = new ColumnHeader();
          header.Text = "#";
          header.TextAlign = HorizontalAlignment.Center;
          header.Width = 30;
          listView1.Columns.Add(header);
  
          TimerCallback tcb = this.UpdateListView;
  
          System.Threading.Timer updateTimer = new System.Threading.Timer(tcb, null, 0, 1000);
      }
  
      public void UpdateListView(object obj)
      {
          ListViewItem item;
          listView1.Items.Clear();
  
          for (int i = 0; i &lt; 10; i++)
          {
              item = new ListViewItem(i.ToString());
  
              listView1.Items.Add(item);
          }
  
      }
  }
  </code></pre>
  
  <p>... what am I missing here?</p>
  
  <p>** <strong>EDIT</strong> **</p>
  
  <p>There's no error, the program just <em>ends</em> like if I would call <code>System.Environment.Exit(0);</code></p>
  
  <pre><code>A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
  The program '[4644] ProgramTest.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
  The program '[4644] ProgramTest.vshost.exe: Program Trace' has exited with code 0 (0x0).
  </code></pre>