I tried to use the bug report feature, but it would not work.
The following code will cause ncrunch to crash when automatic test running is enabled. Visual studio 2010, NUnit 2.5.1 that comes with ReSharper 6:
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using CustomExtensions.ForIEnumerable;
using NUnit.Framework;
namespace UnitTests.ForIEnumerablesTests
{
[TestFixture]
public class IsEmptyTest
{
// Class to test non-Generic ICollection
private class TestObj <T> : ArrayList, IEnumerable<T>
{
public IEnumerator<T> GetEnumerator()
{
return GetEnumerator();
}
}
[Test]
public void TestTestObj()
{
var testObj = new TestObj<int>();
testObj.Add(1);
Assert.That(() => testObj.ToList(), Throws.Nothing); // <== Uncommenting this line will cause instant crash
}
}
This code causes a catastrophic crash because it causes a stack overflow to be thrown.
Stack overflows are a bit of a nightmare for NCrunch and test runners in general. They can't be caught or handled, so they give you a big nasty popup dialog instead. I've been working on ways to improve the user experience around them, although any workarounds tried so far have been particularly unreliable.
For the time being, the best thing to do if you experience a stack overflow is to set the engine to manual mode until you can fix the test causing the problem.
Thank you for your response. I knew the code was bad, but now I understand the difficulty you would have in catching that kind of error. I was a little surprised at the pop up, so I wanted to make sure it wasn't something you were not aware of. Sounds like you have it under control. I have only been using NCrunch for a couple of days so far, but I can say that it has been a great help to me, especially the code coverage indication. Thanks again.