我有一组运行良好的 TestFixtures。我在装置中添加了一个新的测试,但由于某种原因,我无法运行它。其他类(class)甚至同一类(class)的其他测试都运行良好。
- 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;"
}
这会导致堆栈溢出 - 但不小心编写的递归方法也会导致堆栈溢出。
关于.net - 为什么使用 NUnit/TestDriven.Net2.0 测试会崩溃?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2077596/