title: StackOverflowException without recursion or infinite loop?
body: <h3>Background</h3>
  <p>I have a <code>DataGridView</code> control which I am using, and I added my handler below to the <code>DataGridView.CellFormatting</code> event so the values in some cells can be made more human-readable. This event handler has been working great, formatting all values without issue.</p>
  <p>Recently however, I have discovered a very rare circumstance causes an unusual bug. The column in my <code>DataGridView</code> for the item's due date always has an <code>int</code> value. <code>0</code> indicates the event is never due, any other value is a UTC timestamp for the due date. The MySQL db column corresponding doesn't allow nulls. When the user has moved from one <code>DataGridView</code> row with a due date, to another <code>DataGridView</code> row with a due date (at this point everything is still appears fine), and then presses a button which reloads the data from the database (without sending updates, essentially calling <code>DataAdapter.Fill()</code>), the program generates a <code>StackOverflowException</code>**.</p>
  <h3>No recursion?</h3>
  <p>What is so unusual to me is that I do not see where the recursion or infinte-looping is. I added <code>int cellFormatCallCount</code> as a class member, and increment it during each call, but at the time the exception is thrown, the debugger shows the value of that <code>int</code> as 1, which I would expect since I wasn't under the impression and recursion was occuring.</p>
  <p>Can somebody help me?</p>
  <p>How can I view a stack trace? In VS2008 it says:
  <code>{Cannot evaluate expression because the current thread is in a stack overflow state.}</code></p>
  <p>Best regards,</p>
  <p>Robinson</p>
  <pre><code>private int cellFormatCallCount = 0;
  private void myDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)  {
      try {
          // to format the cell, we will need to know its value and which column its in
          string value = &quot;&quot;;
          string column = &quot;&quot;;
          
          // the event is sometimes called where the value property is null
          if (e.Value != null) {
              cellFormatCallCount++; // here is my test for recursion, this class member will increment each call
  
              // This is the line that throws the StackOverflowException
              /* ********************* */
              value = e.Value.ToString();
              /* ********************* */
  
              column = actionsDataGridView.Columns[e.ColumnIndex].Name;
          } else {
              return; // null values cannont be formatted, so return
          }
  
          if (column == &quot;id&quot;) {
              // different code for formatting each column
          } else if (column == &quot;title&quot;) {
              // ...
          } else {
              // ...
          }
      } finally {
          cellFormatCallCount = 0; // after we are done with the formatting, reset our recursion counter
      }
  }
  </code></pre>