nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00605
[Bug 600555] [NEW] NUnit throws NullReferenceException when return null from ISuiteBuilder.BuildFrom(Type) method
Public bug reported:
Version: 2.5.5, GUI Runner
On the NUnit-site the documentation regarding the ISuiteBuilder-
interface is as follows (http://www.nunit.org/index.php?p=suiteBuilders&r=2.5.5):
"CanBuildFrom should return true if the specified Type is one from
which the builder is able to create a fixture. This usually involve
examining the Type and its attributes.
The BuildFrom method should return a test fixture completely populated
with its contained test cases. Return null if it is not possible to
build a fixture using the provided Type."
However, when a custom implementation of the ISuiteBuilder-interface
returns NULL after calling the BuildFrom(Type)-method, a
NullReferenceException is thrown:
System.NullReferenceException...
Server stack trace:
at NUnit.Core.NamespaceTreeBuilder.Add(TestSuite fixture)
at NUnit.Core.NamespaceTreeBuilder.Add(IList fixtures)
at NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(String
assemblyName, IList fixtures, Boolean autoSuites)
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(I ntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(Ru ntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMess age
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)
The problem could be solved by either updating the documentation by not
allowing a NULL-value to be returned (recommended), or by accepting
null-values and not crashing.
** Affects: nunitv2
Importance: Undecided
Status: New
--
NUnit throws NullReferenceException when return null from ISuiteBuilder.BuildFrom(Type) method
https://bugs.launchpad.net/bugs/600555
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
Status in NUnit V2 Test Framework: New
Bug description:
Version: 2.5.5, GUI Runner
On the NUnit-site the documentation regarding the ISuiteBuilder-
interface is as follows (http://www.nunit.org/index.php?p=suiteBuilders&r=2.5.5):
"CanBuildFrom should return true if the specified Type is one from
which the builder is able to create a fixture. This usually involve
examining the Type and its attributes.
The BuildFrom method should return a test fixture completely populated
with its contained test cases. Return null if it is not possible to
build a fixture using the provided Type."
However, when a custom implementation of the ISuiteBuilder-interface returns NULL after calling the BuildFrom(Type)-method, a NullReferenceException is thrown:
System.NullReferenceException...
Server stack trace:
at NUnit.Core.NamespaceTreeBuilder.Add(TestSuite fixture)
at NUnit.Core.NamespaceTreeBuilder.Add(IList fixtures)
at NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(String
assemblyName, IList fixtures, Boolean autoSuites)
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(I ntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(Ru ntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMess age
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)
The problem could be solved by either updating the documentation by not allowing a NULL-value to be returned (recommended), or by accepting null-values and not crashing.
Follow ups
References