From 750997c0434378a1c60d54a847d056b5e6d5601b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Hude=C4=8Dek?= Date: Thu, 5 Mar 2026 16:42:44 +0100 Subject: [PATCH] Clarify the deprecation of [Timeout] The new documentation of the [Timeout] attribute introduced two weeks ago states that attribute "doesn't work" but that's not quite accurate, and as evidenced by my own usage and by the usage of others in GitHub items on this project, that partial functionality of the [Timeout] attribute is actively being used, so I would prefer if the documentation described the functionality in more detail as opposed to stating it doesn't work, which may lead readers to mistakenly assume that the [Timeout] attribute does nothing, which isn't true. --- docs/articles/nunit/writing-tests/attributes/timeout.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/articles/nunit/writing-tests/attributes/timeout.md b/docs/articles/nunit/writing-tests/attributes/timeout.md index 232a158b7..d50620695 100644 --- a/docs/articles/nunit/writing-tests/attributes/timeout.md +++ b/docs/articles/nunit/writing-tests/attributes/timeout.md @@ -1,10 +1,12 @@ # Timeout > [!NOTE] -> The Timeout attribute does not work from .NET 5 and upwards due to limitations in the runtime. -> Beginning in NUnit version 4.5, usage of Timeout attribute on .NET 5 or higher is reported as a failure. +> Starting from .NET 5, due to limitations in the runtime, the Timeout attribute works only partially. It will cancel the test +> for the purposes of test results reporting and scheduling of further tests, but the test's code will continue to run on the test's +> thread in the background. Starting from NUnit version 4.5, usage of Timeout attribute at all on .NET 5 or higher is reported +> as a failure. -## Alternatives to the Timeout attribute for .net 5 and above +## Alternatives to the Timeout attribute for .NET 5 and above If you want to cancel the Test in the same manner, use the [CancelAfter Attribute](./cancelafter.md). It is cooperative cancelling, so your test needs to handle the CancellationToken.