nunit broken when using .Net 2.0 library

Bug #38801 reported by Arthur Peters
14
Affects Status Importance Assigned to Milestone
nunit (Debian)
Fix Released
Undecided
Jelmer Vernooij
nunit (Ubuntu)
Fix Released
Medium
Jelmer Vernooij

Bug Description

nunit does not work when using .Net 2.0 standard library (tested with System.Collections.Generic.List).

I read somewhere (I looked but now I cannot find the reference) that the problem was caused by the fact that nunit it not built against the 2.0 libraries, so they cannot be found at runtime.

Here is a log of the problem. The source file is attached:

amp@newbie:~/programs$ gmcs -r:/usr/lib/nunit/nunit.framework.dll nunit-with-2.0.cs
amp@newbie:~/programs$ nunit-console nunit-with-2.0.exe
NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Unix 2.6.15.20 Mono Version: 1.1.4322.2032

.
** (/usr/lib/nunit/nunit-console.exe:18617): WARNING **: The class System.Collections.Generic.List`1 could not be loaded, used in mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Stacktrace:

in (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[]) <0x4>
in (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[]) <0xfff49c4d>
in System.Reflection.MonoMethod:Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <0x8d>
in System.Reflection.MethodBase:Invoke (object,object[]) <0x1a>
in NUnit.Core.Reflect:InvokeMethod (System.Reflection.MethodInfo,object) <0x2d>
in NUnit.Core.TemplateTestCase:doTestCase (NUnit.Core.TestCaseResult) <0x2d>
in NUnit.Core.TemplateTestCase:doRun (NUnit.Core.TestCaseResult) <0x5a>
in NUnit.Core.TemplateTestCase:Run (NUnit.Core.TestCaseResult) <0x111>
in NUnit.Core.TestCase:Run (NUnit.Core.EventListener) <0x9f>
in NUnit.Core.TestCase:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) <0x11>
in NUnit.Core.TestSuite:RunAllTests (NUnit.Core.TestSuiteResult,NUnit.Core.EventListener,NUnit.Core.IFilter) <0x1a3>in NUnit.Core.TestSuite:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) <0xe8>
in NUnit.Core.TestSuite:RunAllTests (NUnit.Core.TestSuiteResult,NUnit.Core.EventListener,NUnit.Core.IFilter) <0x1a3>in NUnit.Core.TestSuite:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) <0xe8>
in NUnit.Core.TestSuite:RunAllTests (NUnit.Core.TestSuiteResult,NUnit.Core.EventListener,NUnit.Core.IFilter) <0x1a3>in NUnit.Core.TestSuite:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) <0xe8>
in NUnit.Core.AssemblyTestSuite:Run (NUnit.Core.EventListener,NUnit.Core.IFilter) <0x51>
in NUnit.Core.RemoteTestRunner:Run (NUnit.Core.EventListener,NUnit.Core.Test[]) <0x303>
in NUnit.Core.RemoteTestRunner:Run (NUnit.Core.EventListener,NUnit.Core.Test) <0x4d>
in NUnit.Core.RemoteTestRunner:Run (NUnit.Core.EventListener) <0x13>
in (wrapper remoting-invoke-with-check) NUnit.Core.RemoteTestRunner:Run (NUnit.Core.EventListener) <0xffffec1b>
in (wrapper xdomain-dispatch) NUnit.Core.RemoteTestRunner:Run (object,byte[]&,byte[]&) <0xacca>
in (wrapper xdomain-invoke) NUnit.Core.RemoteTestRunner:Run (NUnit.Core.EventListener) <0xfffd2fd0>
in NUnit.Util.TestDomain:Run (NUnit.Core.EventListener) <0x88>
in NUnit.Console.ConsoleUi:Execute (NUnit.Util.ConsoleOptions) <0x3d4>
in NUnit.Console.ConsoleUi:Main (string[]) <0x127>
in (wrapper runtime-invoke) System.Object:runtime_invoke_int_string[] (object,intptr,intptr,intptr) <0xabcbef>

Native stacktrace:

        /usr/lib/libmono.so.0(mono_handle_native_sigsegv+0xe3) [0xb7e3943f]
        /usr/lib/libmono.so.0 [0xb7dfb03e]
        [0xffffe440]
        /usr/lib/libmono.so.0 [0xb7ecaea5]
        /usr/lib/libmono.so.0(mono_type_create_from_typespec_full+0x13f) [0xb7ecdb7f]
        /usr/lib/libmono.so.0 [0xb7edfb23]
        /usr/lib/libmono.so.0 [0xb7edfcdc]
        /usr/lib/libmono.so.0(mono_class_get_full+0x24) [0xb7edfe6c]
        /usr/lib/libmono.so.0 [0xb7ed8af8]
        /usr/lib/libmono.so.0 [0xb7ed8fec]
        /usr/lib/libmono.so.0(mono_get_method_full+0x59) [0xb7ed9889]
        /usr/lib/libmono.so.0 [0xb7e0a2a2]
        /usr/lib/libmono.so.0(mini_method_compile+0x267) [0xb7e16313]
        /usr/lib/libmono.so.0 [0xb7e1804d]
        /usr/lib/libmono.so.0 [0xb7e1841d]
        /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0xb7e7aeed]
        /usr/lib/libmono.so.0(mono_runtime_invoke_array+0x161) [0xb7e7ee07]
        /usr/lib/libmono.so.0 [0xb7e85852]
        [0xb703f02c]
        [0xb6f88c4e]
        [0xb6ff4e1b]
        [0xb6f88b3e]
        [0xb6f88a3e]
        [0xb6f8881b]
        [0xb6f88542]
        [0xb6f880a8]
        [0xb6f87fe2]
        [0xb6f8763c]
        [0xb6f85129]
        [0xb6f8763c]
        [0xb6f85129]
        [0xb6f8763c]
        [0xb6f85129]
        [0xb6f84f62]
        [0xb6fb861c]
        [0xb6fb821e]
        [0xb6fb81b4]
        [0xb6fb816e]
        [0xb6fb6d44]
        [0xb6fc18a3]
        [0xb6f947a9]
        [0xb7126595]
        [0xb735bbb8]
        [0xb735b874]
        /usr/lib/libmono.so.0 [0xb7e18438]
        /usr/lib/libmono.so.0(mono_runtime_invoke+0x33) [0xb7e7aeed]
        /usr/lib/libmono.so.0(mono_runtime_exec_main+0xa8) [0xb7e7dac9]
        /usr/lib/libmono.so.0(mono_runtime_run_main+0x188) [0xb7e80bf0]
        /usr/lib/libmono.so.0(mono_jit_exec+0x90) [0xb7e2ab5e]
        /usr/lib/libmono.so.0(mono_main+0x962) [0xb7e2b54f]
        /lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xd2) [0xb7bc7ea2]
        /usr/bin/cli [0x8048459]
Aborted

Revision history for this message
Arthur Peters (amp) wrote : File that exibits the problem

A C# source file that is a simple example of the problem with NUnit and .Net 2.0 libraries.

Revision history for this message
Sebastian Dröge (slomo) wrote :

this is a known problem and would be fixed by a nunit-console compiled against the 2.0 libs. I'll try to get this done for dapper... thanks for reporting :)

Changed in nunit:
assignee: nobody → slomo
status: Unconfirmed → Confirmed
Revision history for this message
Arthur Peters (amp) wrote :

http://www.nunit.org/index.php?p=configFiles&r=2.2.5

I ran across this in the NUnit documentation. I thought it might help.

I says that nunit uses "config files" (I'm assuming this means the .config files I see associated with .Net stuff and don't understand) to allow the same binary to be run against either .Net 1.0, 1.1, or 2.0.

Revision history for this message
Sebastian Dröge (slomo) wrote :

hm, could you make a 2.0 testcase that works with a 1.1 nunit?

Revision history for this message
Arthur Peters (amp) wrote :

Yes and no. I am using the 1.1 nunit libraries, but I built nunit-console with gmcs. I used the above unit tests.

Here is a log:

$ apt-get source nunit
...
$ cd nunit-2.2.0/nunit-console
$ gmcs -r:/usr/lib/nunit/nunit.core.dll -r:/usr/lib/nunit/nunit.util.dll ConsoleUi.cs AssemblyInfo.cs -out:nunit-console-2.0.exe
...
[copy nunit-with-2.0.exe produced from the nunit-with-2.0.cs attached above into this directory]
$ MONO_PATH=/usr/lib/nunit ./nunit-console-2.0.exe nunit-with-2.0.exe
NUnit version 2.2.0
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Unix 2.6.15.20 Mono Version: 2.0.50727.42

.
Tests run: 1, Failures: 0, Not run: 0, Time: 0.150514 seconds

[cut]

I have used this technic with a larger test suite too and it works fine (the tests for a program I am writting in nemerle).

Hope this helps.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

It'll be hard to fix this bug until nant (which nunit uses for its buildsystem) gets built with NET 2.0 support.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Now that there is a .NET 2.0 build of nant, this should be doable. I've started working on a .NET 2.0 version of NUnit which should be in Debian soon (and hopefully in edgy shortly afterwards).

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This bug was fixed in the upload of the new nunit 2.4 package.

Changed in nunit:
assignee: nobody → jelmer
status: New → Fix Released
assignee: slomo → jelmer
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.