Skip to content

try-not-restoring#15476

Draft
nohwnd wants to merge 1 commit intomicrosoft:mainfrom
nohwnd:try-not-restoring
Draft

try-not-restoring#15476
nohwnd wants to merge 1 commit intomicrosoft:mainfrom
nohwnd:try-not-restoring

Conversation

@nohwnd
Copy link
Copy Markdown
Member

@nohwnd nohwnd commented Mar 10, 2026

Description

Please add a meaningful description for this change.
Ensure the PR has required unit tests.

Related issue

Kindly link any related issues. E.g. Fixes #xyz.

  • I have ensured that there is a previously discussed and approved issue.

Copilot AI review requested due to automatic review settings March 10, 2026 21:15
Copy link
Copy Markdown
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 aims to reduce unnecessary dotnet restore work during acceptance/integration test asset preparation, primarily by skipping restores when inputs appear unchanged and adding more timing/diagnostic logging.

Changes:

  • Added additional stopwatch timing logs around test asset builds.
  • Skipped restoring TestPlatform/TestPlatform.CLI when the corresponding NuGet cache version directories already exist.
  • Removed the restore step when the compatibility-matrix cache id matches, and added logs for “up to date / generating” states.

{
// Project cache is up-to-date, just rebuilding solution.
ExecuteApplication2(Dotnet, $"""restore --packages {nugetCache} {nugetFeeds} --source "{IntegrationTestEnvironment.LocalPackageSource}" "{generatedSln}" """);
ExecuteApplication2(Dotnet, $"build {generatedSln} --no-restore --configuration {IntegrationTestEnvironment.BuildConfiguration} -v:minimal");
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Removing the dotnet restore here can break builds in cases where the cache-id matches but restore outputs are missing (e.g., cleared/expired NuGet cache, deleted obj/project.assets.json, or a partially-populated cache). Consider keeping a restore step, or gating --no-restore on the presence of required restore artifacts (e.g., solution/project assets files) before skipping restore.

Suggested change
ExecuteApplication2(Dotnet, $"build {generatedSln} --no-restore --configuration {IntegrationTestEnvironment.BuildConfiguration} -v:minimal");
ExecuteApplication2(Dotnet, $"build {generatedSln} --configuration {IntegrationTestEnvironment.BuildConfiguration} -v:minimal");

Copilot uses AI. Check for mistakes.
var netTestSdkVersionDir = netTestSdkVersion.TrimStart('[').TrimEnd(']');
if (Directory.Exists(Path.Combine(nugetCache, "microsoft.testplatform", netTestSdkVersionDir)) && Directory.Exists(Path.Combine(nugetCache, "microsoft.testplatform.cli", netTestSdkVersionDir)))
{
Debug.WriteLine($"Version {netTestSdkVersion} of TestPlatform and TestPlatform.CLI is already in the cache, skipping restore.");
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

Grammatically, this refers to two packages, so it should use plural agreement (e.g., 'are already in the cache').

Suggested change
Debug.WriteLine($"Version {netTestSdkVersion} of TestPlatform and TestPlatform.CLI is already in the cache, skipping restore.");
Debug.WriteLine($"Version {netTestSdkVersion} of TestPlatform and TestPlatform.CLI are already in the cache, skipping restore.");

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants