1

When a test causes a StackOverflowException what is the best way to determine which test that failed?

I'm working on a fairly large project in Visual Studio. There are ~4300 tests. At least one of them is causing a StackOverflowException. No test show up as failing, all I get is a message in the Output pane saying:

The active test run was aborted. Reason: Process is terminating due to StackOverflowException.

I've been in this situation before and resolved it by selecting a bunch of tests, ran them, and repeated until I could finally determine which test that caused the exception.

Is there a better way? Maybe it's possible to find out which tests that were running when the exception occurred?

Mårten Wikström
  • 11,074
  • 5
  • 47
  • 87

1 Answers1

0

I post this from my experience in a big project, if you encounter that StackOverflowException, just put a breakpoint before any kind of process and run in Debug Mode, use F10 and F11 when needed and watch carefully if at any point the process will stop moving forward. If you find that line the problems is solved. One particular case was when someone created method to delete every documents in a folder before any test starts, folder which from my machine was missing and caused StackOverflowException being thrown