-
Notifications
You must be signed in to change notification settings - Fork 4
Analyze repository with .NET 9 BuildChecks and document findings #437
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
Changes from all commits
0e2a063
3b6d174
5e77cad
ef99b4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # .NET 9 BuildCheck Analysis Report | ||
|
|
||
| ## Executive Summary | ||
|
|
||
| Analysis completed using .NET 9 BuildChecks on the Moq.Analyzers repository. BuildChecks are enabled and functional, detecting 2 specific property initialization issues in the MSBuild project files. | ||
|
|
||
| ## Analysis Setup | ||
|
|
||
| - **Command Used**: `dotnet build /check` | ||
| - **Repository**: rjmurillo/moq.analyzers | ||
| - **BuildCheck Status**: ✅ Enabled and functioning | ||
| - **Date**: 2025-01-07 | ||
| - **Projects Analyzed**: All projects in Moq.Analyzers.sln | ||
|
|
||
| ## BuildCheck Findings | ||
|
|
||
| ### 1. Property Usage Before Initialization (BC0202) | ||
|
|
||
| **Severity**: Error | ||
| **BuildCheck Code**: BC0202 | ||
| **Documentation**: https://aka.ms/buildcheck/codes#BC0202 | ||
|
|
||
| #### Issues Found: | ||
|
|
||
| 1. **EnforceExtendedAnalyzerRules Property** | ||
| - **File**: `/src/Analyzers/Moq.Analyzers.csproj` | ||
| - **Line**: Line 9, Column 5 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected an indentation at 4 instead of at 3. |
||
| - **Issue**: Property declared/initialized at line 9 but used before it was initialized | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected an indentation at 4 instead of at 3. |
||
| - **Location Found**: `/usr/share/dotnet/sdk/9.0.100/Roslyn/Microsoft.Managed.Core.targets(176,9)` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected an indentation at 4 instead of at 3. |
||
|
|
||
| 2. **Description Property** | ||
| - **File**: `/src/Analyzers/Moq.Analyzers.csproj` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Expected an indentation at 4 instead of at 3. |
||
| - **Line**: Line 20, Column 5 | ||
| - **Issue**: Property declared/initialized at line 20 but used before it was initialized | ||
| - **Location Found**: `/usr/share/dotnet/sdk/9.0.100/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(33,5)` | ||
|
|
||
| ## Technical Analysis | ||
|
|
||
| ### Issue 1: EnforceExtendedAnalyzerRules | ||
| The `EnforceExtendedAnalyzerRules` property is set to `true` in line 9 of the project file, but the Microsoft.Managed.Core.targets file attempts to access this property before the project's PropertyGroup has been fully processed. This is a timing issue in MSBuild property evaluation. | ||
|
|
||
| ### Issue 2: Description | ||
| The `Description` property is defined in line 20 but is being referenced by the NuGet packing targets before the property is available. This suggests the packing process is trying to access package metadata too early in the build process. | ||
|
|
||
| ## Recommendations for Sub-Issues | ||
|
|
||
| Based on the BuildCheck analysis, the following sub-issues should be created: | ||
|
|
||
| ### Sub-Issue 1: Fix EnforceExtendedAnalyzerRules Property Initialization Timing | ||
| - **Priority**: Medium | ||
| - **Type**: Build Improvement | ||
| - **Description**: Move the `EnforceExtendedAnalyzerRules` property to an earlier PropertyGroup or investigate MSBuild property evaluation order | ||
| - **Impact**: Ensures proper MSBuild property initialization sequence | ||
|
|
||
| ### Sub-Issue 2: Fix Package Description Property Initialization Timing | ||
| - **Priority**: Medium | ||
| - **Type**: Build Improvement | ||
| - **Description**: Restructure package metadata properties to be available before NuGet packing targets need them | ||
| - **Impact**: Prevents property access before initialization in NuGet packaging process | ||
|
|
||
| ### Sub-Issue 3: Add BuildCheck Integration to CI/CD Pipeline | ||
| - **Priority**: Low | ||
| - **Type**: Process Improvement | ||
| - **Description**: Integrate `dotnet build /check` into the continuous integration pipeline to catch build script regressions | ||
| - **Impact**: Proactive detection of MSBuild issues in future changes | ||
|
|
||
| ## Additional Notes | ||
|
|
||
| - **Positive Finding**: No double-write issues, missing reference issues, or target framework mismatches were detected | ||
| - **SquiggleCop Warnings**: The analysis also revealed baseline mismatches in SquiggleCop configuration, but these are unrelated to .NET 9 BuildChecks | ||
| - **Build Success**: Despite the BuildCheck errors, the actual functionality builds successfully, indicating these are process/timing issues rather than functional defects | ||
|
|
||
| ## BuildCheck Status Verification | ||
|
|
||
| ✅ BuildCheck is successfully enabled and operational | ||
| ✅ BuildCheck diagnostics are being generated and reported | ||
| ✅ BuildCheck error codes and documentation links are provided | ||
| ✅ Multiple projects tested with consistent results | ||
|
|
||
| ## Conclusion | ||
|
|
||
| The repository's build scripts are generally well-structured with only minor property initialization timing issues detected by .NET 9 BuildChecks. These issues do not prevent successful builds but represent opportunities for MSBuild best practices improvements. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected an indentation at 4 instead of at 3.