Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Over-building: _TouchLastBuildWithSkipAnalyzers runs after the build, but its output is considered as an input to the build by FUTDC #9611

Open
nagya opened this issue Dec 4, 2024 · 1 comment
Assignees
Labels
Feature-Up-to-date Build up-to-date check that avoids shelling out to MSBuild unless necessary. Triage-Investigate Reviewed and investigation needed by dev team

Comments

@nagya
Copy link

nagya commented Dec 4, 2024

Visual Studio Version

17.12.2

Summary

The _TouchLastBuildWithSkipAnalyzers target runs after CoreCompile (i.e. after producing the output dll), however its output (a file called <projectfile>.BuildWithSkipAnalyzers) is considered an input to the build by the fast up-to-date check. This causes non-deterministic over-building in the case when the timestamp of the *.BuildWithSkipAnalyzers file ends up being newer than that of the dll produced by CoreCompile, i.e. the time elapsed between writing the dll and writing the sentinel file is more than the resolution of file timestamps.

Steps to Reproduce

Non-deterministic, depends on timing. In a particular observed case, project X has not changed at all and only some trivial, implementation-only code changes happened in project Y since the last build (project Y has a project reference to X.) However, FUTDC has determined that project X needs to be re-built, because in the last build, the sentinel file was written with a timestamp newer than the dll.

Expected Behavior

Project X is not re-built.

Actual Behavior

1>FastUpToDate: Comparing timestamps of inputs and outputs: (X)
1>FastUpToDate: Input UpToDateCheckInput item '...\X.csproj.BuildWithSkipAnalyzers' is newer (2024-11-25 10:21:17.927) than earliest output '...\X.dll' (2024-11-25 10:21:17.913), not up-to-date. (X)

User Impact

Increased build time due to over-building.

@haileymck haileymck added Triage-Investigate Reviewed and investigation needed by dev team Feature-Up-to-date Build up-to-date check that avoids shelling out to MSBuild unless necessary. labels Dec 5, 2024
@drewnoakes
Copy link
Member

.BuildWithSkipAnalyzers is written whenever you perform an "indirect" build in VS. That includes when you run unit tests, or when you launch into the debugger. In both of those cases, we intentionally skip running Roslyn analyzers, as they delay the time it takes to get test results or your code launched.

That file's timestamp is what allows a subsequent "direct" build (i.e. invoking a build command) to ensure that analyzers are run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Up-to-date Build up-to-date check that avoids shelling out to MSBuild unless necessary. Triage-Investigate Reviewed and investigation needed by dev team
Projects
None yet
Development

No branches or pull requests

3 participants