When working with some recursive code, you can get into a situation where the code is infinetly recursive, and the resulting StackOverflowException crashes the workers.
Just as a contrived example:
[Test]
Example_DoesNotStackOverflow()
{
Example("abc");
}
private void Example(string foo)
{
if (string.IsNullOrEmpty(foo)) return;
foo = foo.Remove(0, 1); // Commenting out this line (even for a tiny fraction of a second) causes NCrunch workers to explode.
Example(foo);
}
I have no problem with the tests failing in that case, but I don't think that it is a good thing to have the test worker processes exploding and bringing up Windows Error Reporting boxes.
Agreed. This is hard to fix because the CLR behaviour is to always terminate a process when it hits a stack overflow - there's no way to handle this exception. You'll notice other test runners behave the same way.
I have some loose plans that may improve the experience around this in a later release, but for now it is what it is unfortunately.