Skip to content

File-based apps: fix up-to-date checks of RunCommand - #54556

Merged
jjonescz merged 5 commits into
dotnet:release/10.0.4xxfrom
jjonescz:54551-sprint-no-build-run-command
Jun 30, 2026
Merged

jjonescz merged 5 commits into
dotnet:release/10.0.4xxfrom
jjonescz:54551-sprint-no-build-run-command

Conversation

@jjonescz

@jjonescz jjonescz commented Jun 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #54551.

Review tips: commit-by-commit; ignore whitespace.

@jjonescz
jjonescz requested a review from Copilot June 2, 2026 13:49
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Jun 2, 2026

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

This PR addresses #54551 by ensuring file-based dotnet run re-evaluates the virtual project to compute RunCommand when properties change under --no-build, aligning behavior more closely with project-based runs. It also lifts the previous restriction that prevented combining --no-build and --no-cache for file-based apps, with updated tests to validate the new behavior.

Changes:

  • Allow dotnet run --no-build --no-cache (previously rejected) and adjust file-based run-property caching logic to re-evaluate when inputs/global properties change.
  • Add/relocate tests to validate cached vs re-evaluated RunCommand behavior for file-based apps, including --no-build scenarios.
  • Update internal RunCommand.GetTargetCommand(...) call sites to include the new runPropertiesFromEvaluation flag (used for verbose diagnostics).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/dotnet.Tests/CommandTests/Run/RunFileTests_CscOnlyAndApi.cs Removes the now-obsolete test that asserted --no-build and --no-cache are invalid together.
test/dotnet.Tests/CommandTests/Run/RunFileTests_BuildCommands.cs Adds coverage for RunCommand caching vs re-evaluation, including property changes under --no-build and --no-cache.
test/dotnet.Tests/CommandTests/Run/RunCommandTests.cs Updates tests for the new GetTargetCommand signature.
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Refactors build-level computation and exposes it for --no-build run-property checks; adjusts --no-cache behavior.
src/Cli/dotnet/Commands/Run/RunCommand.cs Removes the --no-build+--no-cache exception; reworks --no-build file-based path to re-evaluate when run properties may be stale.
src/Cli/dotnet/Commands/Run/Api/RunApiCommand.cs Updates call site for the new GetTargetCommand signature.

Comment on lines 252 to 255
}

Debug.Assert(buildLevel is BuildLevel.All or BuildLevel.Csc);
Debug.Assert(result != 0);
}

@jjonescz jjonescz Jun 3, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch; that's a pre-existing issue, but I guess I can fix it in this PR since I'm touching caching code anyway. I don't think it's actually observable currently though (so I'm not adding a test for it).

@jjonescz
jjonescz requested a review from RikkiGibson June 4, 2026 09:08
@jjonescz

jjonescz commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@RikkiGibson for a second review, thanks

3 similar comments
@jjonescz

Copy link
Copy Markdown
Member Author

@RikkiGibson for a second review, thanks

@jjonescz

Copy link
Copy Markdown
Member Author

@RikkiGibson for a second review, thanks

@jjonescz

Copy link
Copy Markdown
Member Author

@RikkiGibson for a second review, thanks

@jjonescz
jjonescz enabled auto-merge (squash) June 30, 2026 07:41
@jjonescz
jjonescz merged commit 0b1151a into dotnet:release/10.0.4xx Jun 30, 2026
28 checks passed
@jjonescz
jjonescz deleted the 54551-sprint-no-build-run-command branch June 30, 2026 08:54
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 11.0-preview7 milestone Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-run-file Items related to the "dotnet run <file>" effort

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants