Repository navigation
Let hosts give extension directories to the engine before it starts - #26
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hosts currently add extension directories to
IExtensionServiceafter the engine has started, then callInstallExtensions()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), besideWorkDirectoryandInternalTraceLevel, which hosts already set beforeInitialize(). When it initializes, the engine adds the directories named inNUNIT_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
TestEnginemust implement the new property. TestCentric'sMockTestEngineand its oneInstallExtensions()call need the same update when it next takes this package.🤖 Generated with Claude Code