【问题标题】:NUnit/Mono not printing stack trace line number even with --debug即使使用 --debug,NUnit/Mono 也不会打印堆栈跟踪行号
【发布时间】:2014-03-25 14:26:17
【问题描述】:

好的,事情就是这样,在 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(导致堆栈跟踪)显示相应的行号。

【问题讨论】:

  • 好的,所以如果添加了-framework=3.5,它就可以工作了。
  • -runtime=v4.0 应该添加到单声道命令行
  • 您应该发布您的解决方案作为答案并接受它。
  • 即使这些信息对我也没有帮助,还有其他想法吗?

标签: c# mono nunit nunit-console


【解决方案1】:

为我解决问题的是选项

-runtime=v4.0

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

【讨论】:

    【解决方案2】:

    尝试像这样将“-config=Debug”参数传递给 nunit-console:

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

    【讨论】:

    • 同样的事情,还是什么都没有
    • 工作目录中是否存在所有 .mdb 文件以及 test.exe 二进制文件?
    • 是的,.mdbs 在那里
    • 我可以确认我遇到了完全相同的问题。我花了两个小时尝试一切可能让它工作但没有任何帮助。我建议您在nunit-discuss 邮件列表中讨论这个问题,您应该会得到更多答案。
    猜你喜欢
    • 2018-07-06
    • 1970-01-01
    • 2015-07-27
    • 1970-01-01
    • 1970-01-01
    • 2012-05-26
    • 2013-09-03
    • 2011-06-03
    • 1970-01-01
    相关资源
    最近更新 更多