【问题标题】:Why Test crashes using NUnit / TestDriven.Net2.0?为什么使用 NUnit / TestDriven.Net2.0 测试会崩溃?
【发布时间】:2010-01-16 14:26:14
【问题描述】:

我有一组运行良好的 TestFixture。我在夹具中添加了一个新的测试,但由于某种原因,我无法运行它。其他类甚至同一个类中的其他测试运行良好。

  • NUnit GUI / TestDriven 崩溃

如果我从 NUnit GUI 运行,我会收到此错误:

NUnit 已停止处理此消息

Description:
  Stopped working

Problem signature:
  Problem Event Name:   CLR20r3
  Problem Signature 01: nunit.exe
  Problem Signature 02: 2.5.3.9345
  Problem Signature 03: 4b2334ce
  Problem Signature 04: Engine
  Problem Signature 05: 1.0.0.0
  Problem Signature 06: 4b51c6fe
  Problem Signature 07: ad
  Problem Signature 08: 0
  Problem Signature 09: System.StackOverflowException
  OS Version:   6.0.6001.2.1.0.768.3
  Locale ID:    2057

在VS2008中使用TestDriven.Net 2.0,得到这个错误:

TestDriven.Net 2.0 已停止工作

Description:
  Stopped working

    Problem signature:
      Problem Event Name:   CLR20r3
      Problem Signature 01: processinvocation86.exe
      Problem Signature 02: 3.0.2556.0
      Problem Signature 03: 4af0254b
      Problem Signature 04: Engine
      Problem Signature 05: 1.0.0.0
      Problem Signature 06: 4b51c6fe
      Problem Signature 07: ad
      Problem Signature 08: 0
      Problem Signature 09: System.StackOverflowException
      OS Version:   6.0.6001.2.1.0.768.3
      Locale ID:    2057

【问题讨论】:

    标签: .net nunit stack-overflow executable


    【解决方案1】:

    嗯,很明显您正在导致堆栈溢出。 StackOverflowException 是一个致命异常,它会导致 CLR 崩溃 - 这就是您看到该问题的原因。

    我建议您调试测试以找出堆栈溢出的原因。这通常是一个递归问题。例如,如果您在属性中有错字:

     private readonly int age;
    
     public int Age
     {
         get { return Age; } // should be "return age;"
     }
    

    这将导致堆栈溢出 - 但不小心编写的递归方法也会如此。

    【讨论】:

    • 谢谢,这正是我的问题! :)
    猜你喜欢
    • 2012-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-31
    • 2014-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多