Add aspire new diagnostic logging#17570
Draft
sebastienros wants to merge 1 commit into
Draft
Conversation
Add bounded diagnostics for template version selection, AppHost package restore, AppHost server startup, RPC connection/authentication, and scaffold RPC calls so hangs during polyglot project creation can be localized from debug logs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17570Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17570" |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds diagnostic logging across the aspire new TypeScript AppHost creation path to make template/package selection, restore, server lifecycle, transport connection, authentication, and RPC waits easier to diagnose.
Changes:
- Adds reusable diagnostic helpers for slow-task warnings and restored AppHost package version logging.
- Instruments template resolution, AppHost preparation/build/restore, RPC connection/authentication/invocation, and RemoteHost JSON-RPC connection lifecycle.
- Updates tests that construct
TemplateNuGetConfigServiceto pass aNullLogger.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Aspire.Cli/Commands/NewCommand.cs |
Logs template channel discovery, candidate previews, and selected template version reason. |
src/Aspire.Cli/NuGet/BundleNuGetService.cs |
Logs restored AppHost package versions after cached or fresh bundle restores. |
src/Aspire.Cli/Projects/AppHostRpcClient.cs |
Adds RPC transport/authentication/method timing diagnostics and slow-wait warnings. |
src/Aspire.Cli/Projects/AppHostServerSession.cs |
Logs AppHost server process/session preparation and wraps slow operations with warnings. |
src/Aspire.Cli/Projects/DotNetBasedAppHostServerProject.cs |
Logs in-repo AppHost preparation and restored package versions. |
src/Aspire.Cli/Projects/PrebuiltAppHostServer.cs |
Logs prebuilt AppHost package/project-reference preparation diagnostics. |
src/Aspire.Cli/Templating/TemplateNuGetConfigService.cs |
Adds logging for template package resolution candidates and selection reasons. |
src/Aspire.Cli/Utils/AppHostPackageDiagnostics.cs |
Adds helper for reading and formatting tracked AppHost package versions from assets files. |
src/Aspire.Cli/Utils/DiagnosticLogging.cs |
Adds helper for emitting one-time slow-operation warnings without changing task results. |
src/Aspire.Hosting.RemoteHost/JsonRpcServer.cs |
Enriches JSON-RPC connection accept/listen/cleanup debug logs. |
tests/Aspire.Cli.Tests/Templating/DotNetTemplateFactoryTests.cs |
Updates test construction for the new TemplateNuGetConfigService logger dependency. |
tests/Aspire.Cli.Tests/Templating/TemplateNuGetConfigServiceTests.cs |
Updates test helper construction for the new logger dependency. |
Comment on lines
+75
to
+79
| foreach (var library in libraries.EnumerateObject()) | ||
| { | ||
| if (!library.Value.TryGetProperty("type", out var typeElement) || | ||
| !string.Equals(typeElement.GetString(), "package", StringComparison.OrdinalIgnoreCase) || | ||
| TryParseLibraryName(library.Name) is not { } package) |
Comment on lines
+11
to
+18
| public static async Task<T> WaitWithSlowWarningAsync<T>(Task<T> task, TimeSpan threshold, Action logWarning) | ||
| { | ||
| ArgumentNullException.ThrowIfNull(task); | ||
| ArgumentNullException.ThrowIfNull(logWarning); | ||
|
|
||
| using var delayCancellation = new CancellationTokenSource(); | ||
| var delayTask = Task.Delay(threshold, delayCancellation.Token); | ||
| if (await Task.WhenAny(task, delayTask).ConfigureAwait(false) == delayTask && !task.IsCompleted) |
davidfowl
reviewed
May 28, 2026
| // The backchannel listener registers handlers without a connection name, so this value | ||
| // is purely for grouping client-side spans/metrics in the trace. | ||
| private const string ConnectionName = "remotehost"; | ||
| private static readonly TimeSpan s_slowOperationWarningThreshold = TimeSpan.FromSeconds(5); |
Contributor
|
❌ CLI E2E Tests failed — 105 passed, 2 failed, 2 unknown (commit Failed Tests
View all recordings
📹 Recordings uploaded automatically from CI run #26546999604 |
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.
Description
Adds diagnostic logging for the
aspire newTypeScript AppHost creation path so future hangs or version-skew failures can be localized from debug logs instead of stopping at "Starting JsonRpc server on Unix domain socket".The logs now show:
exact current CLI match,current CLI pin, orlatest fallback).Aspire.Hosting,Aspire.Hosting.CodeGeneration.TypeScript, andAspire.TypeSystem, including the probe manifest path.Manual diagnosis with the instrumented CLI showed the current fixed
release/13.4path selects template/package version13.4.0for--channel dailyviacurrent CLI pin, restores matching13.4.0AppHost packages, connects/authenticates successfully, and completesscaffoldAppHostin 8 ms. A temporary local revert of the current-CLI pinning fallback selected13.5.0-preview.1.26277.15from daily vialatest fallback, restoredAspire.Hosting,Aspire.Hosting.CodeGeneration.TypeScript, andAspire.TypeSystem13.5.0-preview.1.26277.15, then still connected/authenticated successfully and completedscaffoldAppHostin 10 ms andgenerateCodein 65 ms. Forced pre-fix style runs with--version 13.5.0-preview.1.26277.12and.15produced the same successful RPC-boundary result in the current environment, so the earlier hang is not reproducing here.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?