Fix BuildCheck property initialization timing issues (BC0202 errors)#442
Fix BuildCheck property initialization timing issues (BC0202 errors)#442
Conversation
|
|
| @@ -1,4 +1,7 @@ | |||
| <Project> | |||
| <PropertyGroup> | |||
There was a problem hiding this comment.
Expected an indentation at 4 instead of at 2.
| <Project> | ||
| <PropertyGroup> | ||
| <ShowCommonFiles Condition="'$(ShowCommonFiles)' == ''">false</ShowCommonFiles> | ||
| </PropertyGroup> |
There was a problem hiding this comment.
Expected an indentation at 4 instead of at 2.
Co-authored-by: rjmurillo <6811113+rjmurillo@users.noreply.github.com>
d32900b to
a68e7e9
Compare
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Join our Discord community for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
| @@ -1,4 +1,8 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
| <PropertyGroup> | |||
There was a problem hiding this comment.
This was moved from a property group with a label set below but the label did not also move
There was a problem hiding this comment.
Fixed the label placement by adding back the "Shared project settings" label when moving the properties in commit da82f9d.
Co-authored-by: rjmurillo <6811113+rjmurillo@users.noreply.github.com>
|
Code Climate has analyzed commit 543ca2b and detected 2 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Resolves .NET 9 BuildCheck errors where properties were being used before initialization, causing BC0202 violations during
dotnet build /check.Issues Fixed
Two property initialization timing issues were identified and resolved:
Description and EnforceExtendedAnalyzerRules properties in
src/Analyzers/Moq.Analyzers.csprojDirectory.Build.propswith project-specific condition to ensure early availabilityShowCommonFiles property in
src/Common/Common.csprojandsrc/Common/Common.projitemsTechnical Details
The root cause was MSBuild evaluation order - SDK targets (NuGet packing, Roslyn analyzers) were importing and trying to access properties before the project files had a chance to define them. The fix ensures properties are available during the early evaluation phase by:
Directory.Build.propswhich is evaluated before individual project files.projitemsfiles to prevent undefined property accessVerification
dotnet build /checknow passes with 0 errors (previously 2 BC0202 errors)Before/After
Before:
After:
Fixes #441.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.