为什么使用NUnit/TestDriven.Net2.0测试崩溃?

为什么使用NUnit/TestDriven.Net2.0测试崩溃?,.net,nunit,stack-overflow,executable,.net,Nunit,Stack Overflow,Executable,我有一套测试装置运行良好。我在夹具中添加了一个新测试,但由于某些原因,我无法运行它。其他类甚至同一类中的其他测试运行良好 NUnit GUI/TestDriven都会崩溃 如果从NUnit GUI运行,则会出现以下错误: NUnit已停止处理此邮件 Description: Stopped working Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: nunit.exe Prob

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

  • 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

很明显,您造成了堆栈溢出。StackOverflowException是一个致命的异常,它会导致CLR关闭-这就是为什么您会看到这个问题

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

 private readonly int age;

 public int Age
 {
     get { return Age; } // should be "return age;"
 }
这将导致堆栈溢出,但不小心编写的递归方法也会导致堆栈溢出。

谢谢,这正是我的问题!:)