Conversation
Use the scaffold runner metadata for the interactive flow instead of invoking every installed .NET tool with get-commands. Remove the broad discovery APIs so unrelated tools cannot hang or produce side effects during startup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4754ee2b-cd5a-452e-a6ec-2862e8357bee
Route interactive discovery through a composable scaffolder catalog while implementing only the built-in provider. Preserve component identity so registered tool providers can be added later without restructuring the picker. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Keep the existing .NET tool management and discovery APIs unchanged while bypassing broad installed-tool probing in the interactive flow. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Keep the focused built-in metadata conversion test and remove tests of trivial catalog composition and defensive empty input behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Keep the existing logger field and constructor parameter so the discovery fix changes only the category picker's scaffolder source. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Follow the repository style by keeping short predicates and catalog expressions on a single line instead of applying an unconfigured line-length limit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Rename the provider and catalog around metadata, and pass configured scaffolders from the composition root instead of coupling metadata discovery to IScaffoldRunner. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Let the built-in metadata provider retrieve configured scaffolders from IScaffoldRunner so the interactive composition root can use standard service registration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Keep the existing IDotNetToolService discovery flow, but query only Microsoft.dotnet-scaffold by default so unrelated installed tools are never executed with get-commands. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
There was a problem hiding this comment.
🟡 Changes recommended
Discovery still enumerates and may restore unrelated tools before filtering.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR restricts default scaffolder discovery to Microsoft.dotnet-scaffold and updates related API documentation. However, broad tool listing and local restoration still occur before filtering.
Changes:
- Filters default command probing to
Microsoft.dotnet-scaffold. - Updates service documentation.
File summaries
| File | Description |
|---|---|
src/dotnet-scaffolding/dotnet-scaffold/Services/IDotNetToolService.cs |
Documents the restricted default tool set. |
src/dotnet-scaffolding/dotnet-scaffold/Services/DotNetToolService.cs |
Filters discovered tools before querying commands. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
There was a problem hiding this comment.
🟡 Changes recommended
Explicit component discovery must pass the selected component instead of using the restricted default.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7fb3b19f-ebcc-4206-acbe-23ac5b51963d
Avoid depending on an unrestored local installation when retrieving built-in commands. Preserve third-party invocation and tool roll-forward support, and add regression coverage for local and global tool metadata. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b044f665-4dd1-48e1-b5c7-b108fd553e9d
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add regression coverage for the default discovery path, including filtering unrelated tools and skipping restore.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Resolved since last review (1)
Add a narrow execution wrapper so discovery tests can supply local/global tool-list fixtures and record process invocations without running installed tools. Cover null and empty defaults, filtering, restore avoidance, and explicit third-party component behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b044f665-4dd1-48e1-b5c7-b108fd553e9d
|
/azp run scaffolding-ci |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Write the exit code, standard output, and standard error to xUnit output before checking scaffolded files so CI test results retain the underlying failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b044f665-4dd1-48e1-b5c7-b108fd553e9d
Select Microsoft.Extensions 10.0.12 for older-target tool and shared-library builds so DiagnosticSource resolves to its matching framework asset instead of the incompatible .NET Standard fallback. Leave net10 and net11 versions unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b044f665-4dd1-48e1-b5c7-b108fd553e9d


Problem
Running
dotnet scaffoldwithout arguments opens the interactive scaffolding experience. To discover available scaffolders, the tool currently:get-commandsargument.There is no way to know whether an installed tool implements the scaffolding protocol before executing it. An unrelated tool can therefore prevent
dotnet scaffoldfrom starting or cause unexpected side effects. This has resulted in hangs and tools opening UI or starting background processes during scaffolder discovery.Change
This PR keeps the existing scaffolder discovery flow but restricts its default tool set to the installed
Microsoft.dotnet-scaffoldtool. The interactive experience still retrieves its built-in ASP.NET Core and Aspire command metadata through the existingget-commandsprotocol, but it no longer executes unrelated local or global tools. Default built-in discovery also skipsdotnet tool restore, which would otherwise restore every tool in the local manifest; explicitly supplied component lists retain the existing restore behavior.The longer-term extensibility model is explicit opt-in:
dotnet scaffold tool installshould register a scaffolder so that it is included in discovery, anddotnet scaffold tool uninstallshould remove it. The existingIDotNetToolServiceAPIs continue to accept an explicit component list, so a future registered-tool discovery mechanism can supply that intentional set of trusted tools without restoring broad installed-tool probing. #3250 tracks moving the existing install and uninstall commands to theSystem.CommandLinecommand surface; wiring the registered tools into discovery remains future work.This is deliberately a surgical change:
DotNetToolServiceremains responsible for tool discovery and command metadata.Closes #3832.
Validation
dotnet-scaffold.Testsproject builds for .NET 10 with no warnings or errors.Microsoft.dotnet-scaffoldpackage in a local tool manifest alongsideredth.mauidevflow.cli0.23.1 and exercised the productionDotNetToolService.GetAllCommandsParallel()path. Discovery returned all 18 built-in commands in 3.5 seconds without starting a MAUI or broker process.