Skip to content

Ignore DefaultTimeout in all but .NET Framework builds#5140

Merged
OsirisTerje merged 3 commits intomainfrom
defaulttimeout
Feb 26, 2026
Merged

Ignore DefaultTimeout in all but .NET Framework builds#5140
OsirisTerje merged 3 commits intomainfrom
defaulttimeout

Conversation

@manfred-brands
Copy link
Copy Markdown
Member

Fixes #4658
Fixes #5133

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR changes how DefaultTimeout is handled so it is only applied in .NET Framework builds, avoiding failures/behavior changes on modern .NET where thread-abort-based timeouts are unsupported (addressing #4658 and #5133).

Changes:

  • Gate applying FrameworkPackageSettings.DefaultTimeout behind #if NETFRAMEWORK in the framework runner.
  • Gate emitting DefaultTimeout into NUnitLite run settings behind #if NETFRAMEWORK and show a warning in non-NETFRAMEWORK builds.
  • Update runner-setting parsing tests to only expect DefaultTimeout validation behavior on .NET Framework.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/NUnitFramework/tests/Api/TestAssemblyRunnerTests.cs Adjusts which settings are validated as parseable/unparseable depending on NETFRAMEWORK.
src/NUnitFramework/nunitlite/TextUI.cs Warns that DefaultTimeout is ignored outside .NET Framework builds.
src/NUnitFramework/nunitlite/TextRunner.cs Prevents DefaultTimeout from being added to run settings outside .NET Framework builds.
src/NUnitFramework/framework/Api/NUnitTestAssemblyRunner.cs Prevents DefaultTimeout from being applied to TestExecutionContext outside .NET Framework builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 377 to +381
// Apply package settings to the context
#if NETFRAMEWORK
if (Settings.TryGetValue(FrameworkPackageSettings.DefaultTimeout, out var timeout))
context.TestCaseTimeout = ConvertSetting<int>(timeout);
#endif
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With DefaultTimeout now ignored on non-NETFRAMEWORK, it would be good to add a regression test proving that providing the FrameworkPackageSettings.DefaultTimeout setting no longer causes runs to error out on platforms without THREAD_ABORT (the issue being fixed). Currently the updated tests only cover parsing/throwing on NETFRAMEWORK, but don’t assert the new non-framework behavior (i.e., the setting is safely ignored).

Copilot uses AI. Check for mistakes.
@OsirisTerje
Copy link
Copy Markdown
Member

Awesome! I have also removed the same setting from the adapter for non-netframework, and updated docs for the adapter.

OsirisTerje and others added 2 commits February 25, 2026 16:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@OsirisTerje OsirisTerje merged commit 18ef457 into main Feb 26, 2026
5 checks passed
@OsirisTerje OsirisTerje deleted the defaulttimeout branch February 26, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants