Skip to content

Fix Aspire.Hosting analyzer hookup - #15338

Merged
Jose Perez Rodriguez (joperezr) merged 8 commits into
release/13.2from
sebros/hosting-analyzer-hookup
Mar 18, 2026
Merged

Jose Perez Rodriguez (joperezr) merged 8 commits into
release/13.2from
sebros/hosting-analyzer-hookup

Conversation

@sebastienros

@sebastienros Sébastien Ros (sebastienros) commented Mar 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Fix the Aspire.Hosting analyzer hookup so the shared analyzer wiring validates both Aspire.Hosting and Aspire.Hosting.* projects.
  • Align export validation with runtime and codegen behavior for assembly-exported external types, instance members on exported types, ValueTask/ValueTask<T>, arrays of assembly-exported external types, and type-level [AspireExportIgnore].
  • Apply the follow-up review fixes by simplifying src/Directory.Build.targets, restoring the withReference capability ID, consolidating ignore coverage onto types where appropriate, and refreshing the affected codegen snapshots and regression tests.

Fixes # (issue)

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
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 18, 2026 00:46
@github-actions

github-actions Bot commented Mar 18, 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15338

Or

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

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

Updates the Aspire.Hosting integration analyzer wiring and export surface so analyzer validation aligns with runtime behavior and polyglot codegen expectations.

Changes:

  • Fix global MSBuild analyzer hookup for Aspire.Hosting* projects and add targeted analyzer regression tests.
  • Extend analyzer/type compatibility (assembly-exported external types, instance members on exported types, ValueTask/ValueTask, arrays).
  • Adjust/export disambiguation and polyglot surface (union-based withEnvironment, export ID collisions, add [AspireExportIgnore], update snapshots).

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts Updates TS generated surface (notably consolidating env APIs into union-based withEnvironment).
tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt Updates TS capability snapshot to reflect removed/renamed capabilities.
tests/Aspire.Hosting.CodeGeneration.Rust.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.rs Updates Rust generated surface to match consolidated env APIs/capabilities.
tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py Updates Python generated surface to match consolidated env APIs/capabilities.
tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/HostingContainerResourceCapabilities.verified.txt Updates Python capability snapshot (adds/renames capabilities).
tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java Updates Java generated surface to match consolidated env APIs/capabilities.
tests/Aspire.Hosting.CodeGeneration.Go.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.go Updates Go generated surface to match consolidated env APIs/capabilities.
tests/Aspire.Hosting.Analyzers.Tests/AspireExportAnalyzerTests.cs Adds analyzer regression tests for new compatibility rules.
src/Shared/IConfigurationExtensions.cs Marks internal IConfiguration helpers with [AspireExportIgnore] for polyglot export coverage.
src/Directory.Build.targets Fixes analyzer project reference hookup for Aspire.Hosting* projects.
src/Aspire.Hosting/Utils/ExtensionUtils.cs Marks debug inspection helper with [AspireExportIgnore].
src/Aspire.Hosting/ResourceBuilderExtensions.cs Consolidates env export into union-based withEnvironment, disambiguates export IDs, adds/ignores specific exports.
src/Aspire.Hosting/Publishing/PublishingExtensions.cs Marks .NET convenience wrappers with [AspireExportIgnore].
src/Aspire.Hosting/ProjectResourceBuilderExtensions.cs Sets RunSyncOnBackgroundThread for sync callback exports.
src/Aspire.Hosting/ExecutableResourceExtensions.cs Marks model inspection helper with [AspireExportIgnore].
src/Aspire.Hosting/ExecutableResourceBuilderExtensions.cs Sets RunSyncOnBackgroundThread for sync callback exports.
src/Aspire.Hosting/EmulatorResourceExtensions.cs Marks model inspection helper with [AspireExportIgnore].
src/Aspire.Hosting/ContainerResourceExtensions.cs Marks model inspection helpers with [AspireExportIgnore].
src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs Disambiguates capability IDs for parameter-based build arg/secret exports.
src/Aspire.Hosting/ContainerExecutableResourceExtensions.cs Marks model inspection helper with [AspireExportIgnore].
src/Aspire.Hosting/ConnectionStringBuilderExtensions.cs Sets RunSyncOnBackgroundThread for sync callback export.
src/Aspire.Hosting/ConnectionPropertiesExtensions.cs Marks internal helper with [AspireExportIgnore] and fixes formatting.
src/Aspire.Hosting/Aspire.Hosting.csproj Removes local analyzer reference in favor of global MSBuild wiring.
src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs Marks model/annotation inspection helpers with [AspireExportIgnore].
src/Aspire.Hosting/ApplicationModel/ProjectResourceExtensions.cs Marks model/metadata inspection helpers with [AspireExportIgnore].
src/Aspire.Hosting/ApplicationModel/DistributedApplicationModelExtensions.cs Marks model inspection helpers with [AspireExportIgnore].
src/Aspire.Hosting.RemoteHost/Ats/AtsMarshaller.cs Adds special handling for object parameters (union inputs) during JSON unmarshalling.
src/Aspire.Hosting.Integration.Analyzers/AspireExportAnalyzer.cs Extends analyzer rules for assembly-exported external types, instance members on exported types, ValueTask, arrays, and union validation.
src/Aspire.Hosting.Analyzers/Infrastructure/WellKnownTypeData.cs Adds ValueTask/ValueTask well-known type entries.
playground/polyglot/TypeScript/Aspire.Hosting/ValidationAppHost/apphost.ts Updates validation app host usage to the consolidated withEnvironment API.
playground/polyglot/TypeScript/Aspire.Hosting.SqlServer/aspire.config.json Adds polyglot playground config for SqlServer scenario.

@sebastienros
Sébastien Ros (sebastienros) marked this pull request as draft March 18, 2026 00:55
@github-actions

Copy link
Copy Markdown
Contributor

The transient CI rerun workflow requested reruns for the following jobs after analyzing the failed attempt.
GitHub's job rerun API also reruns dependent jobs, so the retry is being tracked in the rerun attempt.
The job links below point to the failed attempt that matched the retry-safe transient failure rules.

  • Tests / Dashboard / Dashboard (ubuntu-latest) - Failed step 'Build test project' will be retried because the job log shows a likely transient infrastructure network failure. Matched pattern: /Unable to load the service index for source https://(?:pkgs.dev.azure.com/dnceng|dnceng.pkgs.visualstudio.com)/public/_packaging//i.

Comment thread src/Directory.Build.targets Resolved
Comment thread src/Directory.Build.targets Resolved
Comment thread src/Directory.Build.targets Resolved
Comment thread src/Shared/IConfigurationExtensions.cs Resolved
Comment thread src/Shared/IConfigurationExtensions.cs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

The transient CI rerun workflow requested reruns for the following jobs after analyzing the failed attempt.
GitHub's job rerun API also reruns dependent jobs, so the retry is being tracked in the rerun attempt.
The job links below point to the failed attempt that matched the retry-safe transient failure rules.

@github-actions

Copy link
Copy Markdown
Contributor

The transient CI rerun workflow requested reruns for the following jobs after analyzing the failed attempt.
GitHub's job rerun API also reruns dependent jobs, so the retry is being tracked in the rerun attempt.
The job links below point to the failed attempt that matched the retry-safe transient failure rules.

  • Tests / MySqlConnector / MySqlConnector (windows-latest) - Failed step 'Build test project' will be retried because the job log shows a likely transient infrastructure network failure. Matched pattern: /Unable to load the service index for source https://(?:pkgs.dev.azure.com/dnceng|dnceng.pkgs.visualstudio.com)/public/_packaging//i.

@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 2 jobs were identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

  • Tests / NATS.Net / NATS.Net (windows-latest) - Post-test cleanup steps 'Upload logs, and test results | Copy CLI E2E recordings for upload | Upload CLI E2E recordings | Generate test results summary | Post Checkout code' matched the Windows process initialization failure override allowlist.
  • Tests / Hosting.Testing / Hosting.Testing (ubuntu-latest) - Failed step 'Build test project' will be retried because the job log shows a likely transient infrastructure network failure. Matched pattern: /Unable to load the service index for source https:\/\/(?:pkgs\.dev\.azure\.com\/dnceng|dnceng\.pkgs\.visualstudio\.com)\/public\/_packaging\//i.

@github-actions

Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 52 recordings uploaded (commit 2537885)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RunWithMissingAwaitShowsHelpfulError ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #23256973279

@joperezr Jose Perez Rodriguez (joperezr) added the Servicing-approved Approved for servicing release label Mar 18, 2026
@joperezr
Jose Perez Rodriguez (joperezr) merged commit 8e4a4b4 into release/13.2 Mar 18, 2026
502 of 507 checks passed
@joperezr
Jose Perez Rodriguez (joperezr) deleted the sebros/hosting-analyzer-hookup branch March 18, 2026 19:58
@dotnet-policy-service dotnet-policy-service Bot added this to the 13.2 milestone Mar 18, 2026
Copilot AI pushed a commit that referenced this pull request Mar 18, 2026
* Fix Aspire.Hosting analyzer hookup

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

* Fix analyzer export after rebase

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

* Remove global namespace qualifiers

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

* Refresh codegen snapshots

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

* Fix TypeScript capability assertions

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

* Fix shared configuration export ignore

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

* Address analyzer review feedback

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

* Refresh container capability snapshot

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

---------

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants