Skip to content

Add optional parameters and programmatic value setting - #18108

Merged
Mitch Denny (mitchdenny) merged 18 commits into
mainfrom
davidfowl/optional-parameter-resources
Oct 12, 2026
Merged

Mitch Denny (mitchdenny) merged 18 commits into
mainfrom
davidfowl/optional-parameter-resources

Conversation

@davidfowl

@davidfowl David Fowler (davidfowl) commented Jun 11, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Parameters currently do not have a complete first-class model for two related scenarios: optional parameters that can intentionally have no value, and programmatic parameter values that can be set by AppHost code instead of only through configuration, prompts, or generated defaults. This change adds both pieces so run, publish, dashboard, C# AppHost, and TypeScript AppHost flows share the same parameter value contract.

Users can now mark parameter resources optional with WithOptional() / WithRequired(...), allowing unset optional parameters to resolve to null without prompting or blocking publish. Users can also inspect and set parameter values programmatically with TryGetCurrentValue(...) and SetValueAsync(...); observed parameter updates synchronize dashboard state, resolve missing-value prompts, and preserve required-parameter validation when a required parameter is cleared.

The implementation centralizes value state on ParameterResource and refactors ParameterProcessor to consume that public/resource-level contract instead of manipulating internal completion state directly. ATS and TypeScript generation expose the value-management APIs, including nullable value metadata for setValueAsync and tryGetCurrentValue.

User-facing usage

C# AppHost:

var messagePrefix = builder.AddParameter("message-prefix")
                           .WithOptional();

if (!messagePrefix.Resource.TryGetCurrentValue(out _))
{
    await messagePrefix.Resource.SetValueAsync("local");
}

TypeScript AppHost:

const messagePrefix = await builder.addParameter("message-prefix").withOptional();
if (await messagePrefix.tryGetCurrentValue() === null) {
    await messagePrefix.setValueAsync({ value: "local" });
}

The TypeScript validation AppHost exercises inspection, assignment, clearing, and required toggling against the generated SDK./

Validation

  • ./build.sh --build /p:SkipNativeBuild=true /p:RepositoryCommit=$(git rev-parse HEAD)
  • dotnet test --project tests/Aspire.Hosting.Tests/Aspire.Hosting.Tests.csproj --no-launch-profile -- --filter-class "*.AddParameterTests" --filter-class "*.ParameterProcessorTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • git diff --check

Fixes #17710

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Copilot AI review requested due to automatic review settings June 11, 2026 04:40
@github-actions

github-actions Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18108

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18108"

@davidfowl David Fowler (davidfowl) changed the title Add optional parameter value management Add optional parameters and programmatic value setting Jun 11, 2026
@davidfowl
David Fowler (davidfowl) force-pushed the davidfowl/optional-parameter-resources branch from 663b2d2 to 564a208 Compare June 11, 2026 04:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds first-class support for optional parameter resources and programmatic parameter value management in Aspire. It introduces a Required property on ParameterResource (defaulting to true), fluent builder extensions (WithOptional(), WithRequired()), and a suite of value-management methods (TrySetValue, TrySetException, SetValueAsync, SetExceptionAsync, TryGetCurrentValue). The ParameterProcessor is refactored to use an observer pattern via ValueChanged events instead of directly manipulating internal TaskCompletionSource state, enabling dashboard state synchronization when values are set programmatically. ATS code generation is updated to propagate nullability metadata for parameters and return types.

Changes:

  • New ParameterResource public API for optional parameters and programmatic value management, with an internal event-based observer pattern consumed by ParameterProcessor for dashboard state synchronization.
  • ParameterProcessor refactored to use thread-safe collections with locks, observer-based state updates, and a new SetValueAsync method for non-interactive value setting.
  • ATS capability scanner updated to detect and propagate C# nullability annotations for method parameters and return types, reflected in TypeScript codegen snapshots.
Show a summary per file
File Description
src/Aspire.Hosting/ApplicationModel/ParameterResource.cs Core changes: Required property, TryGetCurrentValue, TrySetValue, TrySetException, SetValueAsync, SetExceptionAsync, ValueChanged event, ParameterResourceValueChangedEventArgs
src/Aspire.Hosting/Orchestrator/ParameterProcessor.cs Refactored to observer pattern: ObserveParameterValueChanges, thread-safe unresolved parameters, SetValueAsync for non-interactive value setting, SetValueCoreAsync
src/Aspire.Hosting/ParameterResourceBuilderExtensions.cs New WithOptional() and WithRequired(bool) fluent extension methods
src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs Emits "required": false in manifest for optional parameters
src/Aspire.Hosting.RemoteHost/AtsCapabilityScanner.cs Adds NullabilityInfoContext-based nullability detection for parameters and return types, GetEffectiveNullability to unwrap Task<T?>/ValueTask<T?>
playground/TypeScriptAppHost/apphost.mts Playground example using addParameter().withOptional() and tryGetCurrentValue/setValueAsync
tests/Aspire.Hosting.Tests/AddParameterTests.cs Tests for optional parameters, TrySetValue, SetValueAsync, TrySetException, SetExceptionAsync, manifest output
tests/Aspire.Hosting.Tests/Orchestrator/ParameterProcessorTests.cs Tests for processor integration: optional init, programmatic set, dashboard state sync, delete optional
tests/Aspire.Hosting.Tests/ExecutionConfigurationGathererTests.cs Test verifying unset optional parameter env vars are omitted
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs Tests for ATS scanner detecting nullable parameter/return types
tests/.../Snapshots/WithOptionalStringCapability.verified.txt Updated snapshot with IsNullable: true
tests/.../Snapshots/AddTestRedisCapability.verified.txt Updated snapshot with IsNullable: true
tests/.../Snapshots/WithDataVolumeOptionsMerged.verified.ts TypeScript type updated to string | null
tests/.../Snapshots/AtsGeneratedAspire.verified.ts Full generated TypeScript updated with | null for nullable optional params

Copilot's findings

  • Files reviewed: 14/15 changed files
  • Comments generated: 1

Copilot AI review requested due to automatic review settings June 11, 2026 05:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 14/15 changed files
  • Comments generated: 0 new

Make Aspire parameters first-class for both optionality and runtime value
management, and surface the new capabilities to polyglot hosts.

Optional parameters:
- WithOptional() marks a parameter resource as optional so a missing value
  no longer prompts or fails resolution; WithRequired() restores the default
  required behavior. Custom-input parameters honor the Required flag.

Programmatic value management:
- ParameterResource.SetValueAsync / TryGetCurrentValue let code set and read a
  parameter's value at runtime.
- ParameterProcessor.SetValueAsync is the persistence-aware path: with
  saveToUserSecrets it writes the value back to user secrets, and setting a
  value notifies observers so the dashboard reflects the change live.

Polyglot exposure:
- The new methods are exported via ATS ([AspireExport]) so TypeScript, Java,
  Python, Go, and Rust app hosts get them. The generated bindings are additive
  only - no changes to the existing generated surface. Reference-type
  nullability is intentionally not propagated into the model, preserving the
  established convention (for example getConnectionString() stays non-null).

Publish vs run:
- ManifestPublishingContext handles optional parameters when publishing.

Includes unit tests for AddParameter optionality, ParameterProcessor value
management and notification, execution configuration gathering, and the ATS
scanner capability for the new parameter methods.

Related: #17710

Co-authored-by: Copilot <[email protected]>
@davidfowl
David Fowler (davidfowl) force-pushed the davidfowl/optional-parameter-resources branch from 50c76c3 to 3d326cb Compare June 11, 2026 15:06
Copilot AI review requested due to automatic review settings June 11, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot's findings

  • Files reviewed: 14/14 changed files
  • Comments generated: 0 new

@github-actions

Copy link
Copy Markdown
Contributor

❓ CLI E2E Tests unknown — 114 passed, 0 failed, 2 unknown (commit 3d326cb)

View all recordings
- Test Detail
✅ AddPackageInteractiveWhileAppHostRunningDetached Recording · Job · CLI logs
✅ AddPackageWhileAppHostRunningDetached Recording · Job · CLI logs
✅ AgentCommands_AllHelpOutputs_AreCorrect Recording · Job · CLI logs
✅ AgentInitCommand_DefaultSelection_InstallsDefaultSkills Recording · Job · CLI logs
✅ AgentInitCommand_MigratesDeprecatedConfig Recording · Job · CLI logs
✅ AgentInit_NonInteractive_BundleOnlySkillsNotInCatalog Recording · Job · CLI logs
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp Recording · Job · CLI logs
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp_DevLocalhost Recording · Job · CLI logs
✅ AgentMcpListStructuredLogsReturnsLogsFromStarterApp_Isolated Recording · Job · CLI logs
✅ AllPublishMethodsBuildDockerImages Recording · Job · CLI logs
✅ AspireAddAndStartWorkAgainstLegacyAppHostTs Recording · Job · CLI logs
✅ AspireAddPackageVersionToDirectoryPackagesProps Recording · Job · CLI logs
✅ AspireInitSingleFileAppHostRunsViaDotnetRunAppHost Recording · Job · CLI logs
✅ AspireInit_ExistingAppHostDir_RecreatesNuGetConfigKeepsFiles Recording · Job · CLI logs
❔ AspireInit_SolutionFile_BuildsAgainstChannelHive Recording · Job · CLI logs
✅ AspireStartUpdatesStaleTypeScriptAppHostPath Recording · Job · CLI logs
✅ AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps Recording · Job · CLI logs
✅ AspireUpdateRemovesOrphanAppHostPackageVersionWhenSdkAlreadyCurrent Recording · Job · CLI logs
✅ Banner_DisplayedOnFirstRun Recording · Job · CLI logs
✅ Banner_DisplayedWithExplicitFlag Recording · Job · CLI logs
✅ Banner_NotDisplayedWithNoLogoFlag Recording · Job · CLI logs
✅ CertificatesClean_RemovesCertificates Recording · Job · CLI logs
✅ CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate Recording · Job · CLI logs
✅ CertificatesTrust_WithUntrustedCert_TrustsCertificate Recording · Job · CLI logs
✅ ConfigSetGet_CreatesNestedJsonFormat Recording · Job · CLI logs
✅ CreateAndRunAspireStarterProject Recording · Job · CLI logs
✅ CreateAndRunAspireStarterProjectWithBundle Recording · Job · CLI logs
✅ CreateAndRunEmptyAppHostProject Recording · Job · CLI logs
✅ CreateAndRunJavaEmptyAppHostProject Recording · Job · CLI logs
✅ CreateAndRunJsReactProject Recording · Job · CLI logs
✅ CreateAndRunPolyglotAppHostWithDevLocalhostUrls Recording · Job · CLI logs
✅ CreateAndRunPythonReactProject Recording · Job · CLI logs
✅ CreateAndRunTypeScriptEmptyAppHostProject Recording · Job · CLI logs
✅ CreateAndRunTypeScriptStarterProject Recording · Job · CLI logs
✅ CreateJavaAppHostWithViteApp Recording · Job · CLI logs
✅ CreateTypeScriptAppHostWithViteApp_UsesConfiguredToolchain Recording · Job · CLI logs
✅ DashboardRunWithAgentMcpListTracesReturnsNoTraces Recording · Job · CLI logs
✅ DashboardRunWithAgentMcpListTracesReturnsNoTraces_DevLocalhost Recording · Job · CLI logs
✅ DashboardRunWithOtelTracesReturnsNoTraces Recording · Job · CLI logs
✅ DashboardRunWithOtelTracesReturnsNoTraces_DevLocalhost Recording · Job · CLI logs
✅ DeployK8sBasicApiService Recording · Job · CLI logs
✅ DeployK8sWithExternalHelmChart Recording · Job · CLI logs
✅ DeployK8sWithGarnet Recording · Job · CLI logs
✅ DeployK8sWithMongoDB Recording · Job · CLI logs
✅ DeployK8sWithMySql Recording · Job · CLI logs
✅ DeployK8sWithPostgres Recording · Job · CLI logs
✅ DeployK8sWithRabbitMQ Recording · Job · CLI logs
✅ DeployK8sWithRedis Recording · Job · CLI logs
✅ DeployK8sWithSqlServer Recording · Job · CLI logs
✅ DeployK8sWithValkey Recording · Job · CLI logs
✅ DeployTypeScriptAppToKubernetes Recording · Job · CLI logs
✅ DescribeCommandResolvesReplicaNames Recording · Job · CLI logs
✅ DescribeCommandShowsRunningResources Recording · Job · CLI logs
✅ DetachFormatJsonProducesValidJson Recording · Job · CLI logs
✅ DetachFormatJsonProducesValidJsonWhenRestartingExistingInstance Recording · Job · CLI logs
✅ DoPublishAndDeployListStepsWork Recording · Job · CLI logs
✅ DocsCommand_RendersInteractiveMarkdownFromLocalSource Recording · Job · CLI logs
✅ DoctorCommand_DetectsDeprecatedAgentConfig Recording · Job · CLI logs
✅ DoctorCommand_TypeScriptAppHostReportsMissingConfiguredToolchain Recording · Job · CLI logs
✅ DoctorCommand_WithSslCertDir_ShowsTrusted Recording · Job · CLI logs
✅ DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted Recording · Job · CLI logs
✅ DotNetRunFileBasedAppHostUsesAspireCliBundle Recording · Job · CLI logs
✅ DotNetRunProjectAppHostUsesAspireCliBundle Recording · Job · CLI logs
✅ GatewayWithoutExternalEndpoint_FailsPublishWithGuidance Recording · Job · CLI logs
✅ GeneratedAspireDevScript_StartsWatchMode_WithConfiguredToolchain Recording · Job · CLI logs
✅ GlobalMigration_HandlesCommentsAndTrailingCommas Recording · Job · CLI logs
✅ GlobalMigration_HandlesMalformedLegacyJson Recording · Job · CLI logs
✅ GlobalMigration_PreservesAllValueTypes Recording · Job · CLI logs
✅ GlobalMigration_SkipsWhenNewConfigExists Recording · Job · CLI logs
✅ GlobalSettings_MigratedFromLegacyFormat Recording · Job · CLI logs
✅ IngressWithoutExternalEndpoint_FailsPublishWithGuidance Recording · Job · CLI logs
✅ InitTypeScriptAppHost_AugmentsExistingViteRepoInWorkspaceSubdirectory Recording · Job · CLI logs
✅ InteractiveCSharpInitCreatesExpectedFiles Recording · Job · CLI logs
✅ InvalidAppHostPathWithComments_IsHealedOnRun Recording · Job · CLI logs
✅ JavaScriptHostingApisRunFromTypeScriptAppHost Recording · Job · CLI logs
✅ LatestCliCanStartStableChannelAppHost Recording · Job · CLI logs
✅ LatestCliCanStartStableChannelTypeScriptAppHost Recording · Job · CLI logs
✅ LegacySettingsMigration_AdjustsRelativeAppHostPath Recording · Job · CLI logs
✅ LogsCommandShowsResourceLogs Recording · Job · CLI logs
✅ OtelLogsReturnsStructuredLogsFromStarterApp Recording · Job · CLI logs
✅ OtelLogsReturnsStructuredLogsFromStarterAppIsolated Recording · Job · CLI logs
✅ ProcessCommandCallbackReceivesCliArguments Recording · Job · CLI logs
✅ PsCommandListsRunningAppHost Recording · Job · CLI logs
✅ PsFormatJsonOutputsOnlyJsonToStdout Recording · Job · CLI logs
✅ PublishJavaScriptPatternsGeneratesExpectedDockerComposeArtifacts Recording · Job · CLI logs
✅ PublishWithConfigureEnvFileUpdatesEnvOutput Recording · Job · CLI logs
✅ PublishWithDockerComposeServiceCallbackSucceeds Recording · Job · CLI logs
✅ PublishWithoutOutputPathUsesAppHostDirectoryDefault Recording · Job · CLI logs
✅ ResourceCommand_FailedExec_ShowsLogPathAndLogHasEntries Recording · Job · CLI logs
✅ ResourceCommand_SetAndDeleteParameterUpdatesDescribeOutput Recording · Job · CLI logs
✅ RestoreGeneratesSdkFiles Recording · Job · CLI logs
✅ RestoreGeneratesSdkFiles_WithConfiguredToolchain Recording · Job · CLI logs
✅ RestoreRefreshesGeneratedSdkAfterAddingIntegration Recording · Job · CLI logs
✅ RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes Recording · Job · CLI logs
✅ RunFromParentDirectory_UsesExistingConfigNearAppHost Recording · Job · CLI logs
✅ RunReportsSyntaxErrorsForDotNetAppHost Recording · Job · CLI logs
✅ RunReportsSyntaxErrorsForTypeScriptAppHost Recording · Job · CLI logs
✅ SecretCrudOnDotNetAppHost Recording · Job · CLI logs
✅ SecretCrudOnTypeScriptAppHost Recording · Job · CLI logs
✅ StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels Recording · Job · CLI logs
✅ StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets Recording · Job · CLI logs
✅ StartReportsSyntaxErrorsForDotNetAppHost Recording · Job · CLI logs
✅ StartReportsSyntaxErrorsForTypeScriptAppHost Recording · Job · CLI logs
✅ StopAllAppHostsFromAppHostDirectory Recording · Job · CLI logs
✅ StopJavaPolyglotAppHostUsingApphostDirectory Recording · Job · CLI logs
✅ StopNonInteractiveSingleAppHost Recording · Job · CLI logs
✅ StopTypeScriptPolyglotAppHostUsingApphostDirectory Recording · Job · CLI logs
✅ StopWithNoRunningAppHostExitsSuccessfully Recording · Job · CLI logs
✅ TerminalAttachFrontend_ShowsViteHelpAndDetaches Recording · Job · CLI logs
✅ TypeScriptAppHostRunDoesNotDeadlockWhenLazyOptionsInvokeAsyncCallback Recording · Job · CLI logs
✅ TypeScriptAppHostWithVite_AllowsDifferentGuestPkgManager Recording · Job · CLI logs
✅ UnAwaitedChainsCompileWithAutoResolvePromises Recording · Job · CLI logs
❔ UpdateToStable_CSharpEmptyAppHost_KeepsConfigChannel Recording · Job · CLI logs
✅ UpdateToStable_CSharpSingleFileInit_KeepsConfigChannel Recording · Job · CLI logs
✅ UpdateToStable_TypeScriptSingleFileInit_KeepsConfigChannel Recording · Job · CLI logs
✅ UpdateToStable_TypeScript_PreviewsStablePkgsAndKeepsChannel Recording · Job · CLI logs

📹 Recordings uploaded automatically from CI run #27356599605

Preserve resource-level setters and optional null values alongside main's secret redaction, dashboard value metadata, and dismissed-prompt handling. Record secret assignments before releasing value waiters and keep prompt completion from canceling persistence. Regenerate Java and TypeScript SDK snapshots and adapt backchannel tests to nullable parameter values.

Validation: 209 hosting/backchannel tests and 12 code-generation checks passed.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Nullable ATS generation, Python required=False, and resolution-loop concurrency contain correctness defects.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Generated nullable contracts, Python required=False handling, and a parameter-resolution race remain incorrect.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity

Open (3)

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Requiredness changes do not reconcile an existing faulted missing-value task, leaving optional parameters unresolved and prompting incorrectly.

0 open findings

3 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Changing Requiredness Doesn't Reconcile Completed Missing-Value State

src/​Aspire.Hosting/​ApplicationModel/​ParameterResource.cs:112

Changing Required only invalidates a cached lazy lookup; it does not reconcile an already-completed WaitForValueTcs. For example, after a required parameter is cleared with SetValueAsync(null), WithOptional() leaves the completion source faulted, so GetValueAsync() still throws and initialization still prompts even though the parameter is now optional. Reconcile a completed missing-value state when requiredness changes (and notify observers so dashboard/prompt state follows the new contract).

🧠 Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #18108...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The concurrency-sensitive parameter lifecycle and cross-language contract changes require final human and API review.

0 open findings

Previously missed (2)

In code that hasn't changed since last review

Low severity Document null argument exceptions for public method

src/​Aspire.Hosting/​Orchestrator/​ParameterProcessor.cs:473

This public method rejects both a null parameterResource and a null/empty value, but its XML documentation omits those exception contracts. Add <exception> entries so IntelliSense documents the validation callers must satisfy.

Low severity Document null builder exception in WithOptional

src/​Aspire.Hosting/​ParameterResourceBuilderExtensions.cs:222

WithOptional delegates to WithRequired, so a null builder throws, but that public exception contract is missing from this method's XML documentation.

This issue also appears on line 241 of the same file.

🧠 Review effort: Balanced

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Deployment tests starting on PR #18108...

This will deploy to real Azure infrastructure. Results will be posted here when complete.

View workflow run

@github-actions

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes concurrent hosting state and public contracts across five generated SDKs, warranting final human review.

0 open findings

🧠 Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: c63c476d-a728-4c18-9ad1-1f283254aa4a
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

53 / 98 PR test projects · 4 PR jobs, from 31 changed files.

Selected PR test projects (53 / 98)

Aspire.Cli.EndToEnd.Tests, Aspire.Cli.Tests, Aspire.Hosting.Analyzers.Tests, Aspire.Hosting.Azure.Kubernetes.Tests, Aspire.Hosting.Azure.Kusto.Tests, Aspire.Hosting.Azure.Provisioning.Tests, Aspire.Hosting.Azure.Tests, Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Browsers.Tests, Aspire.Hosting.CodeGeneration.Go.Tests, Aspire.Hosting.CodeGeneration.Java.Tests, Aspire.Hosting.CodeGeneration.Python.Tests, Aspire.Hosting.CodeGeneration.Rust.Tests, Aspire.Hosting.CodeGeneration.TypeScript.Tests, Aspire.Hosting.Containers.Tests, Aspire.Hosting.DevTunnels.Tests, Aspire.Hosting.Docker.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.EntityFrameworkCore.Tests, Aspire.Hosting.Foundry.Tests, Aspire.Hosting.Garnet.Tests, Aspire.Hosting.Go.Tests, Aspire.Hosting.Java.Tests, Aspire.Hosting.JavaScript.Tests, Aspire.Hosting.Kafka.Tests, Aspire.Hosting.Keycloak.Tests, Aspire.Hosting.Kubernetes.Tests, Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests, Aspire.Hosting.MongoDB.Tests, Aspire.Hosting.MySql.Tests, Aspire.Hosting.Nats.Tests, Aspire.Hosting.OpenAI.Tests, Aspire.Hosting.Oracle.Tests, Aspire.Hosting.Orleans.Tests, Aspire.Hosting.PostgreSQL.Tests, Aspire.Hosting.Python.Tests, Aspire.Hosting.Qdrant.Tests, Aspire.Hosting.RabbitMQ.Tests, Aspire.Hosting.Radius.Tests, Aspire.Hosting.Redis.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Hosting.Rust.Tests, Aspire.Hosting.Seq.Tests, Aspire.Hosting.SqlServer.Tests, Aspire.Hosting.Testing.Tests, Aspire.Hosting.Tests, Aspire.Hosting.Valkey.Tests, Aspire.Hosting.Yarp.Tests, Aspire.Managed.Tests, Aspire.Playground.Tests, Infrastructure.Tests

Selected PR jobs (4)

cli-starter-validation, extension-e2e, polyglot, typescript-api-compat


How these were chosen — grouped by what changed

⚠️ 39 of the 53 selected test projects come from a single change — src/Aspire.Hosting/ApplicationModel/ParameterResource.cs.

🔧 src/Aspire.Hosting/ApplicationModel/ParameterResource.cs (changed source)
→ 39 via the project graph

show 39

Aspire.Hosting.Analyzers.Tests (2 hops), Aspire.Hosting.Azure.Kubernetes.Tests (2 hops), Aspire.Hosting.Azure.Kusto.Tests (2 hops), Aspire.Hosting.Azure.Provisioning.Tests (3 hops), Aspire.Hosting.Azure.Tests, Aspire.Hosting.Browsers.Tests (2 hops), Aspire.Hosting.Containers.Tests (2 hops), Aspire.Hosting.DevTunnels.Tests (2 hops), Aspire.Hosting.Docker.Tests (2 hops), Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.EntityFrameworkCore.Tests (2 hops), Aspire.Hosting.Foundry.Tests (2 hops), Aspire.Hosting.Garnet.Tests (2 hops), Aspire.Hosting.Go.Tests (2 hops), Aspire.Hosting.Java.Tests (2 hops), Aspire.Hosting.JavaScript.Tests (2 hops), Aspire.Hosting.Kafka.Tests (2 hops), Aspire.Hosting.Keycloak.Tests (2 hops), Aspire.Hosting.Kubernetes.Tests (2 hops), Aspire.Hosting.Maui.Tests, Aspire.Hosting.Milvus.Tests (2 hops), Aspire.Hosting.MongoDB.Tests (2 hops), Aspire.Hosting.MySql.Tests (2 hops), Aspire.Hosting.Nats.Tests (2 hops), Aspire.Hosting.OpenAI.Tests (2 hops), Aspire.Hosting.Oracle.Tests (2 hops), Aspire.Hosting.Orleans.Tests (2 hops), Aspire.Hosting.PostgreSQL.Tests (2 hops), Aspire.Hosting.Python.Tests (2 hops), Aspire.Hosting.Qdrant.Tests (2 hops), Aspire.Hosting.RabbitMQ.Tests (2 hops), Aspire.Hosting.Redis.Tests (2 hops), Aspire.Hosting.Rust.Tests (2 hops), Aspire.Hosting.Seq.Tests (2 hops), Aspire.Hosting.SqlServer.Tests (2 hops), Aspire.Hosting.Testing.Tests (2 hops), Aspire.Hosting.Valkey.Tests (2 hops), Aspire.Hosting.Yarp.Tests (2 hops), Aspire.Playground.Tests

🧪 tests/Aspire.Hosting.Tests/AddParameterTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests
→ 3 via the project graph: Aspire.Hosting.Blazor.Tests, Aspire.Hosting.Dotnet.Tests, Aspire.Hosting.Radius.Tests

🔧 src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs (changed source)
→ 1 directly: Aspire.Hosting.CodeGeneration.Python.Tests
→ 1 via the project graph: Aspire.Hosting.RemoteHost.Tests

🔧 src/Aspire.Hosting.RemoteHost/AtsCapabilityScanner.cs (changed source)
→ 1 directly: Aspire.Hosting.RemoteHost.Tests
→ 1 via the project graph: Aspire.Managed.Tests (2 hops)

📦 affected project Aspire.Hosting.RemoteHost
→ 1 test: Aspire.Cli.EndToEnd.Tests

📄 .github/workflows/polyglot-validation/test-go.sh (changed)
→ 1 directly: Infrastructure.Tests

📄 .github/workflows/polyglot-validation/test-rust.sh (changed)
→ 1 directly: Infrastructure.Tests

🧪 tests/Aspire.Cli.Tests/CliBootstrapTests.cs (changed test)
→ 1 directly: Aspire.Cli.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/AtsGeneratedAspire.verified.go (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Go.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Go.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Java.Tests/AtsJavaCodeGeneratorTests.cs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Java.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Java.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Java.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Python.Tests/AtsPythonCodeGeneratorTests.cs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Python.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/AtsGeneratedAspire.verified.py (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Python.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Python.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/AtsGeneratedAspire.verified.rs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Rust.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.Rust.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.TypeScript.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.TypeScript.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.TypeScript.Tests

🧪 tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/TestTypes/TestTypes.cs (changed test)
→ 1 directly: Aspire.Hosting.CodeGeneration.TypeScript.Tests

🧪 tests/Aspire.Hosting.Tests/Backchannel/AuxiliaryBackchannelRpcTargetTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

🧪 tests/Aspire.Hosting.Tests/ExecutionConfigurationGathererTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

🧪 tests/Aspire.Hosting.Tests/Orchestrator/ParameterProcessorTests.cs (changed test)
→ 1 directly: Aspire.Hosting.Tests

Job reasons

Job Triggered by
cli-starter-validation affected project Aspire.Managed
extension-e2e • src/Aspire.Hosting.RemoteHost/AtsCapabilityScanner.cs, src/Aspire.Hosting/ApplicationModel/ParameterResource.cs, src/Aspire.Hosting/Orchestrator/ParameterProcessor.cs, src/Aspire.Hosting/ParameterResourceBuilderExtensions.cs, src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs
• affected project Aspire.Hosting.RemoteHost
polyglot • .github/workflows/polyglot-validation/test-go.sh, .github/workflows/polyglot-validation/test-rust.sh, tests/PolyglotAppHosts/Aspire.Hosting/Go/apphost.go, tests/PolyglotAppHosts/Aspire.Hosting/Java/AppHost.java, tests/PolyglotAppHosts/Aspire.Hosting/Python/apphost.py, tests/PolyglotAppHosts/Aspire.Hosting/TypeScript/apphost.mts
• affected project Aspire.Hosting.CodeGeneration.Python
• affected project Aspire.Hosting.Azure.Provisioning.KeyVault
typescript-api-compat affected project Aspire.Hosting.CodeGeneration.Python

Selection computed for commit 488c932.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The cross-language public API and concurrent parameter lifecycle changes warrant final human review despite extensive focused coverage.

0 open findings

🧠 Review effort: Balanced

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Pull request created: #1871

Generated by PR Documentation Check · copilot · auto · 104.8 AIC · ⌖ 18.5 AIC · ⊞ 20.4K

@aspire-repo-bot

Copy link
Copy Markdown
Contributor

📝 Documentation has been drafted in microsoft/aspire.dev#1871 targeting release/17.0.

Added two new sections to fundamentals/external-parameters.mdx: "Optional parameters" (documents WithOptional()/WithRequired(bool) on ParameterResource, including the manifest-publish restriction) and "Set and inspect parameter values programmatically" (documents TryGetCurrentValue/SetValueAsync, with C# and TypeScript examples). Triggered signals: pr_body_has_user_facing_section (PR body's "User-facing usage" section with C#/TypeScript WithOptional/TryGetCurrentValue/SetValueAsync examples was used as the primary source), pr_body_has_cli_flag_mention (build/test command mentions, not user-facing CLI surface — no CLI docs change needed), polyglot_code_generator_changed (ATS/polyglot SDK export changes for withOptional/withRequired/setValueAsync/tryGetCurrentValue; covered via the TypeScript example mirroring the C# API, consistent with the page's existing bilingual pattern — no separate polyglot reference page exists for this). Review-comment context (manifest schema limitation thrown as DistributedApplicationException, and SetValueAsync not persisting to user secrets by default) was folded into the new prose as an Aside.

Note

This draft PR needs human review before merging.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ParameterProcessor.SetValueAsync and ParameterResource.TryGetCurrentValue for programmatic parameter value management

4 participants