Fix EnforceExtendedAnalyzerRules Property Initialization Timing#440
Fix EnforceExtendedAnalyzerRules Property Initialization Timing#440
Conversation
|
|
…ion timing issue Co-authored-by: rjmurillo <6811113+rjmurillo@users.noreply.github.com>
Co-authored-by: rjmurillo <6811113+rjmurillo@users.noreply.github.com>
|
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 (
|
There was a problem hiding this comment.
Pull Request Overview
This PR resolves an MSBuild property initialization timing issue reported by .NET 9 BuildChecks by moving the EnforceExtendedAnalyzerRules property to a centralized location in CodeAnalysis.props and removing duplicate declarations from individual project files.
- Moved EnforceExtendedAnalyzerRules property to build/targets/codeanalysis/CodeAnalysis.props with a conditional property group.
- Removed duplicate EnforceExtendedAnalyzerRules declarations from three project files.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Moq.Analyzers.Test/Moq.Analyzers.Test.csproj | Removed the EnforceExtendedAnalyzerRules property to avoid early access |
| tests/Moq.Analyzers.Test.Analyzers/Moq.Analyzers.Test.Analyzers.csproj | Removed the EnforceExtendedAnalyzerRules property to prevent duplication |
| src/Analyzers/Moq.Analyzers.csproj | Removed the EnforceExtendedAnalyzerRules property for improved build evaluation |
| build/targets/codeanalysis/CodeAnalysis.props | Added a conditional PropertyGroup to define EnforceExtendedAnalyzerRules early in the build process |
|
Code Climate has analyzed commit 30860e1 and detected 0 issues on this pull request. View more on Code Climate. |
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 |
Summary
Resolves MSBuild property initialization timing issue with
EnforceExtendedAnalyzerRulesdetected by .NET 9 BuildChecks. The property was being accessed byMicrosoft.Managed.Core.targetsbefore PropertyGroup evaluation completed, causing BC0202 errors.Problem
BuildCheck reported the following error:
This occurred because:
EnforceExtendedAnalyzerRuleswas defined in individual project PropertyGroupsSolution
Moved
EnforceExtendedAnalyzerRulesproperty tobuild/targets/codeanalysis/CodeAnalysis.propswith conditional targeting:This ensures:
Changes
CodeAnalysis.propsfor analyzer projectsEnforceExtendedAnalyzerRulesdeclarations from 3 project filesVerification
✅
dotnet build /checkno longer reports BC0202 errors forEnforceExtendedAnalyzerRules✅ Main analyzer project builds successfully
✅ Property correctly applied only to analyzer projects
✅ MSBuild property evaluation timing issue resolved
Fixes #439.
💡 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.