← Back to team overview

nunit-core team mailing list archive

[Bug 1025218] [NEW] Using Open Generic Types In TestFixture Attribute Causes Exception When Loading Test DLL

 

Public bug reported:

The following C# test fixture: (built for .NET 3.5 under VS2010 SP1)

[TestFixture(typeof(List<>))]
public sealed class NUnitBug<T>
{
    [Test]
    public void Test()
    {
    }
}

Causes the following exception when loading the tests in the NUnit GUI
runner:

System.NullReferenceException...

Server stack trace: 
   at NUnit.Core.TypeHelper.GetDisplayName(Type type)
   at NUnit.Core.TypeHelper.GetDisplayName(Type type, Object[] arglist)
   at NUnit.Core.TestSuite..ctor(Type fixtureType, Object[] arguments)
   at NUnit.Core.NUnitTestFixture..ctor(Type fixtureType, Object[] arguments)
   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.BuildSingleAssembly(TestPackage package)
   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, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

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 NUnit.Util.TestDomain.Load(TestPackage package)
   at NUnit.Util.TestLoader.LoadTest(String testName)

Tested in NUnit 2.5.10 and 2.6.0 GUI runners and under ReSharper 6.1.

** Affects: nunitv2
     Importance: Undecided
         Status: New

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

Title:
  Using Open Generic Types In TestFixture Attribute Causes Exception
  When Loading Test DLL

Status in NUnit V2 Test Framework:
  New

Bug description:
  The following C# test fixture: (built for .NET 3.5 under VS2010 SP1)

  [TestFixture(typeof(List<>))]
  public sealed class NUnitBug<T>
  {
      [Test]
      public void Test()
      {
      }
  }

  Causes the following exception when loading the tests in the NUnit GUI
  runner:

  System.NullReferenceException...

  Server stack trace: 
     at NUnit.Core.TypeHelper.GetDisplayName(Type type)
     at NUnit.Core.TypeHelper.GetDisplayName(Type type, Object[] arglist)
     at NUnit.Core.TestSuite..ctor(Type fixtureType, Object[] arguments)
     at NUnit.Core.NUnitTestFixture..ctor(Type fixtureType, Object[] arguments)
     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.BuildSingleAssembly(TestPackage package)
     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, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

  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 NUnit.Util.TestDomain.Load(TestPackage package)
     at NUnit.Util.TestLoader.LoadTest(String testName)

  Tested in NUnit 2.5.10 and 2.6.0 GUI runners and under ReSharper 6.1.

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


Follow ups

References