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

Skip to content

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Feb 20, 2025

Description

Apply behavior from https://github.com/dotnet/aspire/blob/main/docs/specs/IDE-execution.md#launch-profile-processing-project-launch-configuration when displaying args in the dashboard.

Two changes:

  1. When projects are executed by the IDE, the launch args and app host args aren't merged together. Launch args are only displayed if there are no app host args.
  2. If there are no args then project.Spec.Args is left as null. That wasn't happening but appears to have special behavior according to the IDE execution spec. Maybe something along the toolchain automatically converts an empty array to null?

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 Copilot AI review requested due to automatic review settings February 20, 2025 10:21
@JamesNK JamesNK requested a review from mitchdenny as a code owner February 20, 2025 10:21
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.

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

Comments suppressed due to low confidence (2)

tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs:158

  • Slicing exe.Spec.Args without verifying its initialization can lead to a null reference exception when executionType is not IDE. Please ensure that exe.Spec.Args is non-null before attempting to slice it.
var callArgs = executionType == ExecutionType.IDE ? exe.Spec.Args : exe.Spec.Args![^(expectedArgs?.Length ?? 0)..];

tests/Aspire.Hosting.Tests/Dcp/DcpExecutorTests.cs:121

  • [nitpick] The parameter 'executionType' is being compared to ExecutionType.IDE, which may be of a different type than string. Consider aligning the types (for example, by using an enum consistently) to improve clarity and avoid potential type conversion issues.
if (executionType == ExecutionType.IDE)

@JamesNK JamesNK requested a review from davidfowl February 20, 2025 10:26
@JamesNK JamesNK added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Feb 20, 2025
@JamesNK JamesNK requested a review from eerhardt February 20, 2025 10:28
@JamesNK
Copy link
Member Author

JamesNK commented Feb 20, 2025

@captainsafia I think this change removes the need for #7683. Can probably revert it after merge.

@davidfowl davidfowl requested a review from karolz-ms February 20, 2025 14:01
@JamesNK JamesNK added this to the 9.1 milestone Feb 20, 2025
Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

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

Not an expert but LGTM overall -- it does appear that the double --port fix can be reverted with this change set.

Copy link
Member

@adamint adamint left a comment

Choose a reason for hiding this comment

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

just that one question

Copy link
Member

@karolz-ms karolz-ms left a comment

Choose a reason for hiding this comment

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

nice

@danmoseley
Copy link
Member

/backport to release/9.1

Copy link
Contributor

Started backporting to release/9.1: https://github.com/dotnet/aspire/actions/runs/13444068467

@JamesNK
Copy link
Member Author

JamesNK commented Feb 20, 2025

/backport to release/9.1

Copy link
Contributor

Started backporting to release/9.1: https://github.com/dotnet/aspire/actions/runs/13446883474

@JamesNK JamesNK merged commit ae93d20 into main Feb 21, 2025
70 checks passed
@JamesNK JamesNK deleted the jamesnk/command-args-annotations branch February 21, 2025 00:20
@github-actions github-actions bot locked and limited conversation to collaborators Mar 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants