One additional observation: if you think the two arrays in the previous
comment should be considered equal, how do you think these two should be
handled instead?

            object[] array1 = new object[2];
            array1[0] = array1;
            array1[1] = 1;

            object[] array2 = new object[2];
            array2[0] = array2;
            array2[1] = 1;

These are the same arrays as above, just with the elements in the
reverse order.

And what about these two?

            object[] array1 = new object[2];
            object[] array2 = new object[2];

            array1[0] = 1;
            array1[1] = array2;

            array2[0] = 1;
            array2[1] = array1;

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1051847

Title:
  self contained item in array causes stack overflow

Status in NUnit V2 Test Framework:
  Confirmed

Bug description:
  using System.Collections;
  using System.Collections.Generic;
  using NUnit.Framework;

  [TestFixture]
  public class Reproduction {
        class SelfContainer : IEnumerable { public IEnumerator GetEnumerator() 
{ yield return this; } }

        [Test]
        public void SelfContainedItemFoundInArray() {
                var item = new SelfContainer();
                var items = new SelfContainer[] { new SelfContainer(), item };

                // work around
                Assert.True(((ICollection<SelfContainer>)items).Contains(item));

                // causes StackOverflowException
                Assert.Contains(item, items);
        }
  }

  Reproduced in NUnit 2.6.1

  See also bug #491300

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1051847/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~nunit-core
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~nunit-core
More help   : https://help.launchpad.net/ListHelp

Reply via email to