Skip to content

Conversation

@jjonescz
Copy link
Member

Part of #50912.

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Sep 19, 2025
@jjonescz jjonescz marked this pull request as ready for review September 19, 2025 17:14
@jjonescz jjonescz requested review from a team and Copilot September 19, 2025 17:15
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

This PR modifies the file-based caching opt-out mechanism to apply to both the basic up-to-date check and CSC argument caching, rather than just the latter. The change ensures that when FileBasedProgramCanSkipMSBuild=false is set, the system will always perform a full build instead of using any cached optimization.

  • Moves the opt-out check to apply to all caching decisions, not just CSC argument caching
  • Updates test cases to verify the opt-out behavior works for all optimization levels
  • Updates documentation to clarify the scope of the opt-out property

Reviewed Changes

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

File Description
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs Moves the FileBasedProgramCanSkipMSBuild check to encompass all caching operations
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs Enhances existing tests to verify opt-out behavior across different build scenarios
documentation/general/dotnet-run-file.md Updates documentation to clarify the broader scope of the opt-out property

@jjonescz
Copy link
Member Author

@RikkiGibson @333fred @MiYanni for reviews, thanks


Build(testInstance, optOut ? BuildLevel.All : BuildLevel.Csc, expectedOutput: optOut ? "[MyString, UpdatedValue]" : "Resource not found");

Build(testInstance, BuildLevel.All, ["--no-cache"], expectedOutput: "[MyString, UpdatedValue]");
Copy link
Member

Choose a reason for hiding this comment

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

Is the resource found if we build at BuildLevel.Csc after this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it should be, I will extend the test, thanks.

}

void TryCacheCscArguments(CacheInfo cache, BuildResult result, ProjectInstance projectInstance)
void TryCacheCscArguments(CacheInfo cache, BuildResult result)
Copy link
Member

Choose a reason for hiding this comment

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

Consider renaming this method: the Try prefix normally implies that there's a bool result for success.

@baronfel baronfel enabled auto-merge (squash) September 22, 2025 13:43
@baronfel baronfel merged commit 002cab9 into dotnet:release/10.0.1xx Sep 22, 2025
26 of 27 checks passed
@jjonescz jjonescz deleted the sprint-optimization-opt-out branch September 22, 2025 15:51
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.

4 participants