Daily Usage Issues

Recursive code being edited can sometimes cause NCrunch workers to die horriffically.

Started by otac0n on 7,656 views

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.
I don't mind the processes getting torn down, but I would like to avoid the "Windows Error Reporting" boxes from popping up in front of Visual Studio.

Possibly helpful:
http://stackoverflow.com/a/1599236/57986
Yes! This is exactly the plan ;)

Post a reply

Log in to reply.