Skip to content

Test with infinite loop in TearDown cannot be aborted #352

@CharliePoole

Description

@CharliePoole

Pursuant to a discussion on issue #326 I added some tests in order to see the behavior of tests that caused a timeout because of a hung SetUp or a hung TearDown. An infinite loop in the SetUp is handled the same as one in the test but a loop in TearDown causes the entire run to hang.

The cause of this phenomenon is that we run TearDown out of a finally clause. Code in a finally clause is not interupted by a ThreadAbortException.

The same behavior occurs in NUnit V2. See nunit/nunitv2#26

It appears that there are three options:

  1. Don't run TearDown in a finally clause.
  2. Don't use Thread.Abort to cancel a test that times out.
  3. Have NUnit host the CLR and thereby gain the ability to escalate aborts.

All of these are fairly big deals, so some design work is needed.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions