Repository navigation
Avoid template engine initialization for generic help - #56231
Merged
JeremyKuhne merged 1 commit intoSep 10, 2026
Merged
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 2 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrowly scoped changes preserve template-specific behavior; the remaining coverage suggestion is a non-blocking nit.
Pull request overview
Improves generic dotnet new help performance by avoiding unnecessary Template Engine initialization while preserving template-specific help behavior.
Changes:
- Adds early handling for generic help.
- Preserves host initialization for template-specific help.
- Adds regression coverage for host construction.
File summaries
| File | Description |
|---|---|
test/Microsoft.TemplateEngine.Cli.UnitTests/ParserTests/HelpTests.cs |
Verifies generic help does not construct the host. |
src/Cli/Microsoft.TemplateEngine.Cli/Commands/NewCommand.Help.cs |
Skips environment creation for generic help. |
src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.Help.cs |
Centralizes generic-help handling. |
Review details
Suppressed comments (1)
src/Cli/Microsoft.TemplateEngine.Cli/Commands/create/InstantiateCommand.Help.cs:95
- Could you add a product-backed case for
dotnet new create console --help(or an equivalent unit test with a non-emptyShortName)? The changedInstantiateCommand.CustomHelpLayoutbranch is the only direct-createpath that preserves template-specific help, but the current coverage exercises only genericcreateand legacynew <template>help. A regression that routes a non-emptyShortNameto generic help or fails to initialize the environment for this subcommand would therefore go undetected.
if (TryWriteCommandHelp(context, instantiateCommandArgs))
{
return;
}
using IEngineEnvironmentSettings environmentSettings = CreateEnvironmentSettings(instantiateCommandArgs, context.ParseResult);
WriteHelp(context, instantiateCommandArgs, environmentSettings);
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
joeloff
approved these changes
Sep 10, 2026
JeremyKuhne
had a problem deploying
to
copilot-pat-pool
September 10, 2026 17:33 — with
GitHub Actions
Failure
This branch had an error being deployed
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.
Summary
dotnet new --helpanddotnet new create --helpbefore creating the Template Engine host and environmentPerformance
Measured with a Windows x64 Release ReadyToRun
11.0.100-devSDK, alternating fresh processes, isolated CLI homes, and equivalent prepared template state.gc-verbosepairs fell from 1,915,480 B to 1,490,776 B: 424,704 B (22.17%) lowerCreateEnvironmentSettingsandNewCommandParser.CreateHostallocation subtrees were absent from all candidate capturesGCAllocationTickvalues vary at sampling granularity.Testing
HelpTests: 37/37 passed on Releasenet11.0DotnetNewHelpTests: 38/38 passed on Releasenet11.0