Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 22, 2025

When running aspire deploy on Windows, Docker processes were showing flashing console windows during health checks, image tagging, and pushing operations. This was caused by ProcessUtil.Run() missing the CreateNoWindow = true property in its ProcessStartInfo configuration.

The issue was identified by comparing process configurations:

Before (ProcessUtil.Run - causing flashing windows):

StartInfo = {
    // ...
    UseShellExecute = false,
    WindowStyle = ProcessWindowStyle.Hidden,  // Only this was set
}

Working implementations (DotNetCliRunner, DevTunnelCli):

StartInfo = {
    // ...
    UseShellExecute = false,
    CreateNoWindow = true,                    // This prevents flashing
    WindowStyle = ProcessWindowStyle.Hidden,
}

This fix adds CreateNoWindow = true to ProcessUtil.Run(), bringing it in line with other process execution patterns used throughout Aspire. The change affects all processes launched via ProcessUtil.Run(), including:

  • Docker commands (docker push, docker tag, docker buildx, etc.)
  • Podman commands
  • Azure Bicep compilation
  • DCP dependency checks
  • Package fetching operations

The fix is minimal and surgical - adding exactly one line to ensure consistent behavior across all external process execution in Aspire.

Fixes #11499.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…ndows on Windows

Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
Copilot AI changed the title [WIP] When aspire deploy calls docker it is flashing a console window Fix flashing console windows when Docker processes are launched on Windows Sep 22, 2025
Copilot AI requested a review from captainsafia September 22, 2025 16:36
Copilot finished work on behalf of captainsafia September 22, 2025 16:36
@captainsafia
Copy link
Member

@copilot The settings for launching processes already has WindowStyle = ProcessWindowStyle.Hidden. How is setting CreateNoWindow = true different?

Copy link
Contributor Author

Copilot AI commented Sep 22, 2025

@copilot The settings for launching processes already has WindowStyle = ProcessWindowStyle.Hidden. How is setting CreateNoWindow = true different?

The key difference is:

WindowStyle = ProcessWindowStyle.Hidden:

  • Controls the appearance of a process window after it's created
  • The window is created first, then hidden - this can cause a brief flash on Windows
  • Window handle still exists in the system

CreateNoWindow = true:

  • Prevents creating a console window entirely
  • No window handle is created at all
  • Completely eliminates any possibility of flashing

The original code had only WindowStyle = Hidden, which was causing the flashing because windows were being created then hidden. Adding CreateNoWindow = true prevents window creation entirely.

This matches the pattern used by DotNetCliRunner (line 477) which only sets CreateNoWindow = true, and DevTunnelCli (lines 341-342) which sets both properties. The combination provides the most robust solution for background processes.

Commit: 8011b77

Copilot finished work on behalf of captainsafia September 22, 2025 17:01
@captainsafia
Copy link
Member

@copilot Is it valid for both values to be set at the same time on the settings?

Copy link
Contributor Author

Copilot AI commented Sep 22, 2025

@copilot Is it valid for both values to be set at the same time on the settings?

Yes, it's completely valid to set both properties simultaneously. This is demonstrated in the Aspire codebase itself:

  1. DevTunnelCli (lines 341-342) sets both properties together
  2. ProcessUtil (lines 32-33) now sets both properties together
  3. DotNetCliRunner (line 477) only sets CreateNoWindow = true

Setting both is a defensive programming approach - CreateNoWindow = true is the primary mechanism that prevents window creation, while WindowStyle = Hidden serves as a fallback for any edge cases where a window might still be created.

The .NET ProcessStartInfo class accepts both properties without conflict, and the combination provides the most robust solution for background processes.

Copilot finished work on behalf of captainsafia September 22, 2025 17:05
@github-actions
Copy link
Contributor

github-actions bot commented Sep 22, 2025

🚀 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 -- 11570

Or

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

@captainsafia
Copy link
Member

@eerhardt Can you try this and see if it fixes the flashing windows issue you were seeing?

@eerhardt
Copy link
Member

I tried it locally and it does appear to fix the issue. I don't get a flashing console window anymore.

@captainsafia captainsafia marked this pull request as ready for review September 24, 2025 00:02
Copilot AI review requested due to automatic review settings September 24, 2025 00:02
@captainsafia captainsafia merged commit 2550759 into main Sep 24, 2025
318 of 319 checks passed
Copy link
Contributor

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

Fixes flashing console windows when Docker processes are launched on Windows by adding CreateNoWindow = true to ProcessUtil.Run(). The issue occurred during aspire deploy operations where Docker health checks, image tagging, and pushing operations would briefly show console windows.

  • Adds CreateNoWindow = true property to ProcessStartInfo configuration in ProcessUtil.Run()
  • Brings process execution behavior consistent with other Aspire components like DotNetCliRunner and DevTunnelCli
  • Affects all external processes launched via ProcessUtil.Run() including Docker, Podman, Azure Bicep, and DCP operations

@captainsafia captainsafia deleted the copilot/fix-11499 branch September 24, 2025 00:02
@dotnet-policy-service dotnet-policy-service bot added this to the 9.6 milestone Sep 24, 2025
@davidfowl
Copy link
Member

/backport to release/9.5

@github-actions
Copy link
Contributor

Started backporting to release/9.5: https://github.com/dotnet/aspire/actions/runs/17962248734

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.

When aspire deploy calls docker it is flashing a console window

4 participants