NUnit / Mono does not print stack trace line number even with --debug

Ok, here's what using Xamarin on OS X

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

compilation

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

Launch

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

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 libraries, etc. (for example: Monitor and some others)

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

+4
source share
2 answers

The problem was solved for me

-runtime=v4.0

(or appropriate to your case)

+1
source

-config = Debug nunit- :

mono --debug /Users/thiago/qm/nunit/NUnit-2.6.3/bin/nunit-console.exe test.exe -config=Debug
+1

Source: https://habr.com/ru/post/1533354/


All Articles