Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

mitchdenny
Copy link
Member

@mitchdenny mitchdenny commented May 23, 2025

This should fix apparent hangs when doing aspire publish. The root issue was that when the process stdout buffer filled up the process would stop. This resolves that issue by reading out of that buffer as lines are written and piping them to stdout.

We already do this for docker build but hadn't yet done it to dotnet publish.

Fixes: #9233

@Copilot Copilot AI review requested due to automatic review settings May 23, 2025 01:48
@github-actions github-actions bot added the area-engineering-systems infrastructure helix infra engineering repo stuff label May 23, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

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 addresses apparent hangs during dotnet publish by updating the process invocation to use ProcessSpec for streaming output and error data.

  • Replace ProcessStartInfo with ProcessSpec and its callbacks to prevent stdout buffer blockage.
  • Adjust the return type of BuildProjectContainerImageAsync and update PublishCommand's activity loop condition.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Aspire.Hosting/Publishing/ResourceContainerImageBuilder.cs Updated dotnet publish logic to stream process output and removed the string return value.
src/Aspire.Cli/Commands/PublishCommand.cs Modified the publishing activities termination condition logic.
Comments suppressed due to low confidence (2)

src/Aspire.Hosting/Publishing/ResourceContainerImageBuilder.cs:74

  • The method signature has changed from returning a string to void. Please verify that all callers of BuildProjectContainerImageAsync are updated to reflect this change and that any dependencies on its return value are addressed.
private async Task BuildProjectContainerImageAsync(IResource resource, CancellationToken cancellationToken)

src/Aspire.Cli/Commands/PublishCommand.cs:232

  • The updated return condition now depends on all activities being free of errors. Confirm that this logic accurately reflects the intended termination criteria for processing publishing activities.
return lastActivityUpdateLookup.All(kvp => !kvp.Value.IsError);

@mitchdenny mitchdenny self-assigned this May 23, 2025
@mitchdenny mitchdenny added area-cli and removed area-engineering-systems infrastructure helix infra engineering repo stuff labels May 23, 2025 — with GitHub Codespaces
@mitchdenny mitchdenny added this to the 9.4 milestone May 23, 2025
@mitchdenny mitchdenny requested a review from davidfowl May 23, 2025 01:50
@mitchdenny mitchdenny force-pushed the mitchdenny/dotnet-publish-stream-logs branch from 06c98d6 to d6f037a Compare May 23, 2025 04:13
@mitchdenny mitchdenny merged commit c8361ee into main May 23, 2025
254 checks passed
@mitchdenny mitchdenny deleted the mitchdenny/dotnet-publish-stream-logs branch May 23, 2025 04:43
@davidfowl
Copy link
Member

/backport to release/9.3

Copy link
Contributor

Started backporting to release/9.3: https://github.com/dotnet/aspire/actions/runs/15327499000

@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Container image build hangs sometimes
2 participants