Alex Rivera | Logout

How do I track down the cause of a StackOverflowException in .NET?

Asked 2011-02-02T21:03:36.487
32

I get a StackOverflowException when I run the following code:

private void MyButton_Click(object sender, EventArgs e) {
  MyButton_Click_Aux();
}

private static volatile int reportCount;

private static void MyButton_Click_Aux() {
  try { /*remove because stack overflows without*/ }
  finally {
    var myLogData = new ArrayList();
    myLogData.Add(reportCount);
    myLogData.Add("method MyButtonClickAux");
    Log(myLogData);
  }
}

private static void Log(object logData) {
  // my log code is not matter
}

What could be causing the StackOverflowException?

Edit
Report

1 Answer

0

Does Log call back to Log? This would also cause a SO.

answered 2011-02-03T20:30:56.963

Your Answer