Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Recursive code being edited can sometimes cause NCrunch workers to die horriffically.
otac0n
#1 Posted : Wednesday, February 22, 2012 12:10:56 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/22/2011(UTC)
Posts: 51
Location: Seattle, WA

Was thanked: 7 time(s) in 7 post(s)
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:

Code:
[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.
Remco
#2 Posted : Wednesday, February 22, 2012 8:03:07 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
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.
otac0n
#3 Posted : Monday, February 27, 2012 7:30:18 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/22/2011(UTC)
Posts: 51
Location: Seattle, WA

Was thanked: 7 time(s) in 7 post(s)
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
Remco
#4 Posted : Monday, February 27, 2012 7:49:21 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,970

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Yes! This is exactly the plan ;)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download