[fix] Fix MsCoverageReferencedPathMaps: skip during design-time builds and parallelize project builds#16043
Open
nohwnd wants to merge 1 commit into
Open
[fix] Fix MsCoverageReferencedPathMaps: skip during design-time builds and parallelize project builds#16043nohwnd wants to merge 1 commit into
nohwnd wants to merge 1 commit into
Conversation
…add BuildInParallel - Add 'DesignTimeBuild' != 'true' condition to MsCoverageReferencedPathMaps target to prevent it from running during IDE design-time builds (fixes #15105). Design-time builds are frequent background builds triggered by VS for IntelliSense/code analysis, and running MSBuild on all referenced projects during each of these builds causes significant IDE slowdowns. - Add BuildInParallel="true" to the MSBuild task to parallelize the invocation across referenced projects, reducing build times for solutions with many dependencies (partial fix for #15295). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes IDE slowdowns caused by MsCoverageReferencedPathMaps running on every design-time build, and improves performance for real builds by parallelizing referenced project invocations.
Changes:
- Skip the
MsCoverageReferencedPathMapstarget when$(DesignTimeBuild)istrue. - Enable
BuildInParallel="true"on theMSBuildtask for referenced projects.
nohwnd
commented
May 18, 2026
Member
Author
nohwnd
left a comment
There was a problem hiding this comment.
Review Summary
Dimensions activated: Build Script & Infrastructure Hygiene, Dependency & Package Integrity, Cross-TFM & Framework Resolution
Both changes are correct and follow established MSBuild patterns:
DesignTimeBuildguard: canonical SDK pattern; no behavioral change during real builds.BuildInParallel="true": MSBuild batching on%(NearestTargetFramework)still applies correctly per TFM. The invoked target is read-only metadata, so no inter-project hazard. Output item ordering is non-deterministic with parallelism, but source root path maps are an unordered set — downstreamPathMapcompiler arg is not order-sensitive.
No correctness, compatibility, or resource management issues found.
🧠 Reviewed by Expert Code Reviewer
🧠 Reviewed by Expert Code Reviewer 🧠
This was referenced May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated fix generated by GitHub Copilot.
Closes #15105
Partial fix for #15295
Root Cause
The
MsCoverageReferencedPathMapstarget inMicrosoft.CodeCoverage.targetsran unconditionally on everyCoreCompileinvocation, including during IDE design-time builds. Design-time builds happen frequently in the background while you type in Visual Studio (for IntelliSense, error squiggles, etc.) and are triggered far more often than real builds. RunningMSBuildon all referenced projects on every design-time build caused significant IDE slowdowns — especially for solutions with large project graphs.Additionally, the
MSBuildtask invoked referenced projects sequentially (one at a time, batched by TFM), even though the individual project invocations are independent.Fix
Two changes to
Microsoft.CodeCoverage.targets:Skip during design-time builds — Added
'$(DesignTimeBuild)' != 'true'to theMsCoverageReferencedPathMapstarget condition. The SDK sets$(DesignTimeBuild)totrueduring all IDE background build invocations; this is the standard pattern used across the MSBuild ecosystem (e.g., Roslyn analyzers, source generators) to avoid expensive work during design-time passes.Parallelize project invocations — Added
BuildInParallel="true"to theMSBuildtask. This allows the build engine to invoke theInitializeSourceRootMappedPaths/MsCoverageGetPathMaptarget on multiple referenced projects concurrently, reducing wall-clock time for large project graphs.Testing
This is a
.targetsfile change (MSBuild metadata, no C# code). There are no automated tests for this specific target behavior in the repo. The change follows the established SDK pattern for skipping work during design-time builds and is a minimal, low-risk addition to an existing condition.