You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Grace handling user requested process termination #4799
Priority:3Work that is nice to havearea: CLIRelated to dotnet new CLI (usually dotnet/TemplateEngine.CLI source code)triage:close-wont-fixOld/stale issue, unlikely to be addressedtriagedThe issue was evaluated by the triage team, placed on correct area, next action defined.
When user requests a processing exit (via Ctrl-C or Ctrl-Break), templating engine does not grace shut any of it's async processing and the process terminates with wxit code 0xC000013A (STATUS_CONTROL_C_EXIT)
Improved expected behavior:
When user requests a processing exit, templating engine safely cancels all of it's processing, exits once done and signals the situation with exit code 130 (https://tldp.org/LDP/abs/html/exitcodes.html)
How to achieve this:
We should resort from trying to intercept the singla ourselves (with SetConsoleCtrlHandler)
Rather we should use the build in functionality of process termination handling within command-line-api
This will require adding CancelOnProcessTermination to command line builder within sdk
Ideally we should inject this handling for templating subcommand only - in case other subcommands cancellation logic would not be ready (hence leading to uncancellable process). Alternative might be to improve the CancelOnProcessTermination in command line api to allow optional termination processing timeout, after which expiry the process would exit anyway (probably with Environment.Exit(130)) - then we possibly could register the middleware for all dotnet subcommands - those not ready to grace handle cancellation on termination would keep terminating anyways
This issue is being closed as won't fix. It has been open for an extended period without maintainer activity or community demand, and is unlikely to be addressed.
The dotnet/templating repository has been consolidated into dotnet/sdk. If this issue is still important to you, please open a new issue in dotnet/sdk with updated context so the team can re-evaluate.
Triage details
Summary: Request to gracefully handle Ctrl-C process termination in the template engine CLI with proper exit codes
Reasoning: This issue is nearly 4 years old with 0 upvotes and only 1 comment (from the author). Last activity was over 3 years ago (May 2023). It describes improving Ctrl-C handling in the template engine CLI, which requires cross-repo changes in dotnet/sdk and command-line-api. The lack of community interest and long staleness suggest this is unlikely to be prioritized. The consolidation into SDK could make this easier to address but doesn't inherently resolve it.
Priority:3Work that is nice to havearea: CLIRelated to dotnet new CLI (usually dotnet/TemplateEngine.CLI source code)triage:close-wont-fixOld/stale issue, unlikely to be addressedtriagedThe issue was evaluated by the triage team, placed on correct area, next action defined.
Activity
JanKrivanek commentedon May 31, 2022
In other commands we should use the 'sync to async' wrapper: https://github.com/dotnet/sdk/blob/dbf884654f7559433c732267472fffd75db8e33c/src/Cli/dotnet/commands/ParseResultCommandHandler.cs#L8
It should grab the Cancellation token from context and Wait on the Task with that CancellationToken
marcpopMSFT commentedon May 27, 2026
This issue is being closed as won't fix. It has been open for an extended period without maintainer activity or community demand, and is unlikely to be addressed.
The dotnet/templating repository has been consolidated into dotnet/sdk. If this issue is still important to you, please open a new issue in dotnet/sdk with updated context so the team can re-evaluate.
Triage details
Summary: Request to gracefully handle Ctrl-C process termination in the template engine CLI with proper exit codes
Reasoning: This issue is nearly 4 years old with 0 upvotes and only 1 comment (from the author). Last activity was over 3 years ago (May 2023). It describes improving Ctrl-C handling in the template engine CLI, which requires cross-repo changes in dotnet/sdk and command-line-api. The lack of community interest and long staleness suggest this is unlikely to be prioritized. The consolidation into SDK could make this easier to address but doesn't inherently resolve it.