← Back to team overview

nunit-core team mailing list archive

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

 

The bug appears when I reference NUnit 2.6.1 and 2.6.2 in my test
project. When I reference 2.6.0, it works fine.

I used ReSharper 7.0.1 with the included NUnit 2.6.1 as test runner and
I also tried configuring ReSharper to use my installed NUnit 2.6.2 as
test runner.

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


Follow ups

References