c# - NUnit/Mono 即使使用 --debug 也不打印堆栈跟踪行号

标签 c# mono nunit nunit-console

好的,事情是这样的,在 OS X 上使用 Xamarin

(.cs 文件是一个非常简单的测试用例,会导致回溯)

编译

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

运行

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

结果

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 

如果我使用 Xamarin 提供的 nunit-console 它可以工作,但是它不适用于多个库等(例如:Monitor 和其他一些库)

仅运行 mono test.cs(导致堆栈跟踪)显示相应的行号。

最佳答案

为我解决问题的是选项

-runtime=v4.0

(或与您的情况相对应的)

关于c# - NUnit/Mono 即使使用 --debug 也不打印堆栈跟踪行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22637506/

相关文章:

c# - ASP.NET:上传文件错误 "The given path' s 格式不受支持”

c# - 从 BackgroundWorker 开始获取响应

c# - 运行 NUnit 测试时配置文件错误 (TD.NET)

android - Xamarin 为原生开发者构建跨平台 sdk

c# - 如何模拟抽象基类

c# - 在 Azure DevOps 上显示 NUnit 测试代码覆盖率

c# - 数字列表作为 specflow 测试步骤中的参数

c# - 返回一个新值

c# - Asp .Net Core 如何处理区域中的错误页面

c# - 这里发生了什么? (.Net) GC.CollectionCount(0) 不断增加