← Back to team overview

nunit-core team mailing list archive

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

 

Hello Hein,

In R# you can configure a different runner from the R# built-in one:
ReSharper > Options > Unit Testing > NUnit, you can try it. I don't know if
anything like that is available for TeamCity as well, but nonetheless this
looks like a bug as runners should be backwards compatible. What happens if
you run the tests with NUnit's own runner, but a previous version?

Simone


On Thu, Nov 8, 2012 at 4:54 PM, Hein Gustavsen
<1076330@xxxxxxxxxxxxxxxxxx>wrote:

> No, it runs fine with NUnit's runners.
>
> Hein
> On Nov 8, 2012 4:40 PM, "Charlie Poole" <charlie@xxxxxxxxx> wrote:
>
> > Does this problem occur when run under NUnit's own runners?
> >
> > On Thu, Nov 8, 2012 at 3:34 AM, Hein Gustavsen
> > <1076330@xxxxxxxxxxxxxxxxxx> wrote:
> > > Public bug reported:
> > >
> > > 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);
> > >   }
> > > }
> > >
> > > ** Affects: nunitv2
> > >      Importance: Undecided
> > >          Status: New
> > >
> > > --
> > > You received this bug notification because you are subscribed to NUnit
> > > Extended Testing Platform.
> > > https://bugs.launchpad.net/bugs/1076330
> > >
> > > Title:
> > >   Generic Test Fixtures fails with System.NullReferenceException
> > >
> > > To manage notifications about this bug go to:
> > > https://bugs.launchpad.net/nunitv2/+bug/1076330/+subscriptions
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > 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
> >
>
> --
> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~nunit-core
> Post to     : nunit-core@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~nunit-core
> More help   : https://help.launchpad.net/ListHelp
>

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