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

Notification

Icon
Error

ncrunch.TestHost.x86.exe has stopped working - Bug
jomtois
#1 Posted : Monday, September 24, 2012 8:08:59 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/24/2012(UTC)
Posts: 10
Location: Newport, VT

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

Code:

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
		}
}


Let me know if any additional info required.
Remco
#2 Posted : Monday, September 24, 2012 9:06:51 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi, thanks for posting!

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.


Cheers,

Remco
1 user thanked Remco for this useful post.
jomtois on 9/25/2012(UTC)
jomtois
#3 Posted : Tuesday, September 25, 2012 2:37:31 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/24/2012(UTC)
Posts: 10
Location: Newport, VT

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
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.
1 user thanked jomtois for this useful post.
Remco on 9/25/2012(UTC)
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.036 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download