Skip to content

Let hosts give extension directories to the engine before it starts - #26

Merged
CharliePoole merged 1 commit into
mainfrom
extension-directories
Nov 29, 2026
Merged

CharliePoole merged 1 commit into
mainfrom
extension-directories

Conversation

@CharliePoole

Copy link
Copy Markdown
Member

Hosts currently add extension directories to IExtensionService after the engine has started, then call InstallExtensions() to say they've finished. Every host has to know about that final call. Any host that doesn't, including tests, finds no extensions, which shows up as "No available agent matches the TestPackage". The call is needed only because directories arrive after start-up, but in practice every host knows its directories before it starts the engine.

Changes

  • ITestEngine.ExtensionDirectories (IList<string>, get only), beside WorkDirectory and InternalTraceLevel, which hosts already set before Initialize(). When it initializes, the engine adds the directories named in NUNIT_EXTENSION_DIRECTORIES, finds and installs everything in one step, and makes the list read-only.
  • IExtensionService.InstallExtensions() is [Obsolete]. Callers can simply remove the call.
  • IExtensionService.FindExtensionAssemblies(string) is [Obsolete], pointing to the new property. Once the engine has started it will throw.

Both are warnings rather than errors, so existing callers keep compiling. They'll be removed in 5.0. The old remarks on InstallExtensions() said it was called automatically, which was never the case, and are replaced.

Tests

New reflection tests pin the shape of the API: the property exists with no setter, and both methods are obsolete warnings pointing to it. All 72 tests pass on net462 and net8.0.

Follow-up

The engine side is a single nunit4-console PR, which also fixes nunit/nunit-console#1976. It has to adopt this change in the same step, because nunit4-console builds with warnings as errors and TestEngine must implement the new property. TestCentric's MockTestEngine and its one InstallExtensions() call need the same update when it next takes this package.

🤖 Generated with Claude Code

Add ITestEngine.ExtensionDirectories, which hosts fill before the engine is
initialized. The engine can then find and install all extensions when it
starts, so hosts no longer have to add directories to the extension service
and finish with a separate InstallExtensions() call.

IExtensionService.InstallExtensions() and FindExtensionAssemblies(string)
are marked [Obsolete] as warnings, pointing to the new property. They will
be removed in 5.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CharliePoole
CharliePoole merged commit 41b57f3 into main Nov 29, 2026
2 checks passed
@CharliePoole
CharliePoole deleted the extension-directories branch November 29, 2026 17:15
@CharliePoole CharliePoole added this to the 4.0.0-beta.102 milestone Dec 6, 2026
@CharliePoole CharliePoole added the Enhancement New feature or request label Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--trace writes no internal trace log (regression in 4.0.0-beta.5)

1 participant