NUnit/Mono not printing stack trace line number even with --debug
Asked Answered
A

2

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.

Atreus answered 25/3, 2014 at 14:26 Comment(4)
Ok, so if -framework=3.5 is added it works.Atreus
-runtime=v4.0 should be added to the mono command lineAtreus
You should post your solution as an answer and accept it.Acclimate
Even this information does not help for me, any other ideas?Caduceus
A
2

What solved the issue for me was the option

-runtime=v4.0

(or the corresponding one to your case)

Atreus answered 14/5, 2014 at 18:54 Comment(0)
A
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
Acclimate answered 25/3, 2014 at 16:41 Comment(4)
Same thing, still nothingAtreus
Do you have all .mdb files present in the working directory along with test.exe binary?Acclimate
Yes, the .mdbs are thereAtreus
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 mailing list where you should get more answers.Acclimate

© 2022 - 2024 — McMap. All rights reserved.