← Back to team overview

nunit-core team mailing list archive

[Bug 1076330] Re: Generic Test Fixtures fails with System.NullReferenceException

 

You talked about trying this in both 2.6.1 and 2.6.2. Can you
distinguish between two things for me?

1) Which framework version you are referencing in the tests

2) Which NUnit version is being used to run the tests.

We attempt to guarantee backward compatibility (e.g.: NUnit 2.6.2
running 2.6.1 tests) but not forward compatibility (e.g.: NUnit 2.6.1
running 2.6.2 tests).

Charlie

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

Title:
  Generic Test Fixtures fails with System.NullReferenceException

Status in NUnit V2 Test Framework:
  New

Bug description:
  Affects NUnit 2.6.1 and 2.6.2 when tests are run from Resharper or
  TeamCity. NUnit 2.6.0, 2.5.9 and possibly older works fine.

  This is the stack trace from TeamCity build log:

  Loading assembly is compiled for v4.0.30319, x86
  NUnit runner runtime is v4.0.30319, x86
  System.NullReferenceException: Object reference not set to an instance of an object.

  Server stack trace: 
     at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildSingleFixture(Type type, Attribute attr)
     at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildMultipleFixtures(Type type, Attribute[] attrs)
     at NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildFrom(Type type)
     at NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
     at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type)
     at NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly, String ns)
     at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
     at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
     at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
     at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
     at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
     at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
     at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

  Exception rethrown at [0]: 
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
     at NUnit.Core.TestRunner.Load(TestPackage package)
     at JetBrains.TeamCity.NUnitLauncher.NUnitRunner.LoadTest(String testAssembly, String testName, TestRunner runner) in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\NUnit-2.5\NUnitRunner.cs:line 50
     at JetBrains.TeamCity.NUnitLauncher.AssemblyTest.LoadTestDomain() in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\AssemblyTest.cs:line 74
     at JetBrains.TeamCity.NUnitLauncher.LoadTestDomainAction.Action(AssemblyTest test) in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\LoadTestDomainAction.cs:line 15
     at JetBrains.TeamCity.NUnitLauncher.TryOneAssemblyTest.Action() in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\TryOneAssemblyTest.cs:line 18
     at JetBrains.TeamCity.NUnitLauncher.TryOneAssembly.Do() in c:\BuildAgent\work\4fb4fc7600eac5a9\src\NUnitLauncher\src\TryOneAssembly.cs:line 31

  
  This is the test code that causes the failure:

  [TestFixture(typeof(ArrayList))]
  [TestFixture(typeof(List<int>))]
  public class IList_Tests<TList> where TList : IList, new()
  {
    private IList list;

    [SetUp]
    public void CreateList()
    {
      this.list = new TList();
    }

    [Test]
    public void CanAddToList()
    {
      list.Add(1); list.Add(2); list.Add(3);
      Assert.AreEqual(3, list.Count);
    }
  }

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


References