Skip to content

Fix C# .NET 10 project creation failing with invalid CLI args#4992

Draft
Copilot wants to merge 6 commits into
mainfrom
copilot/fix-cli-arguments-for-csharp-functions
Draft

Fix C# .NET 10 project creation failing with invalid CLI args#4992
Copilot wants to merge 6 commits into
mainfrom
copilot/fix-cli-arguments-for-csharp-functions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

Fixes project/function creation failures on .NET 10 caused by invalid CLI arguments being sent to dotnet new (--namespace and --FunctionsHttpPort "undefined").

Root causes

  1. --FunctionsHttpPort "undefined"StringPromptStep.getDefaultValue() called String(this._setting.defaultValue) even when defaultValue was undefined, producing the literal string "undefined". This pre-filled the prompt and was submitted verbatim.
  2. --namespace "Company.Function"DotnetFunctionCreateStep always added --namespace to dotnet new args, but newer .NET templates (e.g. the .NET 10 Azure Functions function template) don't declare namespace as a valid parameter, so the CLI rejects it.
  3. Filtering — the arg filter in executeDotnetTemplateCommand (value !== undefined && value !== '') allowed null and stringified‑nullish values ("undefined", "null") through to the CLI.

Checklist

  • Investigate issue and identify root cause
  • Preserve whether the raw .NET template declares a namespace parameter (supportsNamespace flag on IFunctionTemplate, set in parseDotnetTemplates.ts)
  • Gate --namespace in DotnetFunctionCreateStep on template.supportsNamespace && context.namespace; also skip null values when iterating userPromptedSettings
  • Skip the namespace prompt in DotnetNamespaceStep when the template reports supportsNamespace === false
  • Fix StringPromptStep.getDefaultValue to return undefined when the template has no defaultValue, instead of the literal string "undefined"
  • Harden the arg filter in executeDotnetTemplateCommand.ts to exclude null and literal "undefined"/"null" strings
  • Resolve merge conflict with origin/main (overlapping fix in StringPromptStep.ts from Fix SignalRTrigger C# template showing "null" as default Hub Name #4993)
  • tsc --noEmit and eslint pass clean

Copilot AI requested review from Copilot and removed request for Copilot April 22, 2026 18:22
Copilot AI changed the title [WIP] Fix invalid CLI arguments for C# Azure Functions project creation Fix C# .NET 10 project creation failing with invalid CLI args Apr 22, 2026
Copilot AI requested a review from alexweininger April 22, 2026 18:23
@nturinski
Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

…ents-for-csharp-functions

# Conflicts:
#	src/commands/addBinding/settingSteps/StringPromptStep.ts

Co-authored-by: nturinski <5290572+nturinski@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 6, 2026 16:47
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 6, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 36a7b8e. The only conflict was in StringPromptStep.ts — main's #4993 added the same defaultValue == null guard I had; I kept both the guard and my explanatory comment. tsc --noEmit and eslint pass clean.

Copilot AI requested a review from nturinski May 6, 2026 16:48
Copilot AI review requested due to automatic review settings May 6, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fail to create C# Azure Functions project due to invalid CLI arguments generated by wizard (undefined port and unsupported namespace)

3 participants