7

Ok, here's the thing, using Xamarin on OS X

(the .cs file is a very simple test case that causes a backtrace)

Compiling

mcs /debug /lib:~(...)NUnit-2.6.3/bin/framework/:~(...)NUnit-2.6.3/bin/lib/ -r:nunit.framework.dll test.cs 

Running

mono --debug /Users/thiago/qm/nunit/NUnit-2.6.3/bin/nunit-console.exe test.exe

The result

1) Test Error : TestOne.testFirst
System.NullReferenceException : Object reference not set to an instance of an object
at TestOne.testFirst () [0x00000] in <filename unknown>:0 
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke    (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr,     System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 

If I use the provided nunit-console from Xamarin it works however, it does not work with several libs, etc, (for example: Monitor and some other ones)

Running only mono test.cs (causing a stacktrace) shows the corresponding line numbers.

thiagogalesi
  • 116
  • 6

2 Answers2

2

What solved the issue for me was the option

-runtime=v4.0

(or the corresponding one to your case)

thiagogalesi
  • 116
  • 6
1

Try passing "-config=Debug" parameter to the nunit-console like this:

mono --debug /Users/thiago/qm/nunit/NUnit-2.6.3/bin/nunit-console.exe test.exe -config=Debug
jariq
  • 11,681
  • 3
  • 33
  • 52
  • Same thing, still nothing – thiagogalesi Mar 25 '14 at 16:41
  • Do you have all .mdb files present in the working directory along with test.exe binary? – jariq Mar 25 '14 at 16:43
  • Yes, the .mdbs are there – thiagogalesi Mar 25 '14 at 16:44
  • I can confirm I am experiencing exactly the same issue. I've spent two hours trying everything possible to get it working but nothing helped. I suggest you to discuss this problem in the [nunit-discuss](http://groups.google.com/group/nunit-discuss) mailing list where you should get more answers. – jariq Mar 25 '14 at 22:46