一直发现 mono 的 traceback 没有 fliename、lineno,很奇怪。研究了下,原来编译和运行时要加参数的。

dmcs -debug /r:xunit.dll /t:library MyTest.cs

mono --debug xunit.console.exe MyTest.dll
 
MyTest.FooTest [FAIL]
   Assert.Equal() Failure
   Expected: 4
   Actual:   3
   Stack Trace:
     at MyTest.FooTest () [0x00000] in /Users/kasicass/sandbox/csharp/mytest/MyTest.cs:8 
     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) [0x000d0] in /private/tmp/monobuild/build/BUILD/mono-2.10.8/mcs/class/corlib/System.Reflection/MonoMethod.cs:226
05-08 08:12