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

发布于 2024-08-18 19:33:37 字数 1312 浏览 4 评论 0原文

我有一组运行良好的 TestFixtures。我在装置中添加了一个新的测试,但由于某种原因,我无法运行它。其他班级甚至同一班级的其他测试都运行良好。

  • 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

I have a Set of TestFixtures running fine. I added a new Test into the fixture, but for some reason, I am not able to run it. Other tests in other classes and even in the same class run fine.

  • Both NUnit GUI / TestDriven crash

If I run from NUnit GUI I get this error:

NUnit has stopped Working with this message

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

using TestDriven.Net 2.0 inside VS2008, get this error:

TestDriven.Net 2.0 has stopped working

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

慕巷 2024-08-25 19:33:37

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

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

 private readonly int age;

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

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

Well, it seems fairly clear that you're causing a stack overflow. StackOverflowException is a fatal exception which will bring down the CLR - which is why you're seeing that problem.

I suggest you debug into the test to work out the cause of the stack overflow. It's typically a recursion issue. For example, if you have a typo in a property:

 private readonly int age;

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

That will cause a stack overflow - but so can incautiously written recursive methods.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文