Skip to content

Split analyzer and code fix projects - #4992

Open
rockfordlhotka wants to merge 2 commits into
mainfrom
issue-4638/split-analyzer-and-code-fix-projects
Open

rockfordlhotka wants to merge 2 commits into
mainfrom
issue-4638/split-analyzer-and-code-fix-projects

Conversation

@rockfordlhotka

@rockfordlhotka rockfordlhotka commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Moves the 13 CodeFixProviders out of Csla.Analyzers into a new Csla.Analyzers.CodeFixes project (git mv, namespaces unchanged).
  • Csla.Analyzers now references only Microsoft.CodeAnalysis.CSharp (no Workspaces), so the blanket RS1038 suppression (GlobalSuppressions.cs) is removed.
  • Both assemblies still ship in the Csla package under analyzers/dotnet/cs/ via the existing CslaPackBundledAnalyzers target. The new project is IsPackable=false, so no new package.
  • Code fixes reach the analyzer's internal extension helpers via InternalsVisibleTo. Added PolyUseEmbeddedAttribute to Csla.Analyzers (same as Csla.csproj) so its internal polyfills don't clash with the code fix project's own Polyfill copy.
  • New project added to the analyzer tests, Csla.Analyzers.sln, csla.build.sln, csla.test.sln and csla.maui.build.sln.
  • Fixed the stale tests path in Csla.Analyzers.sln (Csla.Analyzers\Csla.Analyzers.Tests → tests\Csla.Analyzers.Tests); the solution now builds with dotnet build.
  • Removed Csla.Analyzers.Vsix: VS 2017-only, non-SDK project not built by any CI solution, and redundant with the analyzers shipping in the Csla package. Analyzer debugging uses the existing DebugRoslynComponent launch profile.
  • Retired the standalone Csla.Analyzers package path: it was never published (its nupkg never reached bin/packages), so the project is now IsPackable=false and its pack-only items and packages.config-era tools/*.ps1 scripts are removed.

Release note

Not a breaking change for package consumers: diagnostic IDs, severities and code fixes are unchanged, and the IDE loads both DLLs from the package automatically. The only people affected are those who reference Csla.Analyzers.dll directly by path, who would also need to add Csla.Analyzers.CodeFixes.dll to keep the light-bulb fixes.

Test plan

  • dotnet build Source/csla.test.sln: 0 errors, no warnings from the analyzer projects
  • dotnet test Source/csla.test.sln --filter TestCategory!=SkipOnCIServer: all 25 test runs pass (Csla.Analyzers.Tests: 455/455 on net10.0 and net11.0)
  • dotnet pack Source/Csla/Csla.csproj -c Release: nupkg contains analyzers/dotnet/cs/Csla.Analyzers.dll, Csla.Analyzers.CodeFixes.dll, Csla.Generator.AutoImplementProperties.CSharp.dll
  • Csla.Analyzers.dll assembly references no longer include Microsoft.CodeAnalysis.Workspaces
  • Manual: consume the package in VS and confirm a code fix (e.g. CSLA0002 make operation non-public) still shows up
  • dotnet build Source/Csla.Analyzers.sln succeeds

Closes #4638

🤖 Generated with Claude Code

Move the 13 CodeFixProviders out of Csla.Analyzers into a new
Csla.Analyzers.CodeFixes project. The analyzer assembly now references
only Microsoft.CodeAnalysis.CSharp (no Workspaces), so the blanket RS1038
suppression is removed. Both assemblies are still bundled into the Csla
package under analyzers/dotnet/cs via CslaPackBundledAnalyzers.

- Code fixes keep their namespaces; they reach the analyzer's internal
  extension helpers through InternalsVisibleTo
- PolyUseEmbeddedAttribute on Csla.Analyzers so its internal polyfills
  don't clash with the code fix project's own Polyfill copy
- Add the new project to the analyzer tests, solutions and VSIX
- Fix the stale tests path in Csla.Analyzers.sln

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new VSIX solution mappings cause x64/x86 builds to fail, and the standalone analyzer package omits the moved code-fix DLL.

2 open issues
What changed in this PR

Separates CSLA’s code fixes from its diagnostic analyzers to address #4638, removing the analyzer assembly’s Workspaces dependency while bundling both assemblies in the main Csla package.

Changes:

  • Moves 13 code-fix providers into a dedicated project, preserving their namespaces and implementation.
  • Updates dependencies, internal access, and polyfill settings; removes the RS1038 suppression.
  • Integrates the new assembly into packaging, tests, solutions, and the VSIX.
File Description
Source/​tests/​Csla.Analyzers.Tests/​Csla.Analyzers.Tests.csproj References the new code-fix project.
Source/​Csla/​Csla.csproj Builds and bundles the code-fix assembly.
Source/​csla.test.sln Adds code fixes and repairs a project terminator.
Source/​csla.maui.build.sln Adds code fixes to MAUI build configurations.
Source/​csla.build.sln Adds code fixes to framework build configurations.
Source/​Csla.Analyzers/​Csla.Analyzers/​Properties/​AssemblyInfo.cs Grants code fixes access to internal helpers.
Source/​Csla.Analyzers/​Csla.Analyzers/​GlobalSuppressions.cs Removes the RS1038 suppression.
Source/​Csla.Analyzers/​Csla.Analyzers/​Csla.Analyzers.csproj Drops Workspaces and hides internal polyfills.
Source/​Csla.Analyzers/​Csla.Analyzers.Vsix/​source.extension.vsixmanifest Registers the code-fix assembly as VSIX assets.
Source/​Csla.Analyzers/​Csla.Analyzers.Vsix/​Csla.Analyzers.Vsix.csproj References the code-fix project.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​UseGeneratedDataPortalExtensionCodeFix.cs Relocates the generated-extension fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​TypeWithOperationsShouldBePartialAddPartialCodeFix.cs Relocates the partial-type fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​Properties/​AssemblyInfo.cs Grants tests internal access.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​ManagedBackingFieldUsesNameof/​EvaluateManagedBackingFieldsNameofCodeFix.cs Relocates the nameof fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​IsOperationMethodPublicMakeNonPublicCodeFix.cs Relocates the operation-visibility fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​IsCompleteCalledInAsynchronousBusinessRuleRemoveCallCodeFix.cs Relocates the Complete-call removal fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​FindSaveAssignmentIssueAnalyzerAddAsyncAssignmentCodeFix.cs Relocates the asynchronous save-assignment fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​FindSaveAssignmentIssueAnalyzerAddAssignmentCodeFix.cs Relocates the save-assignment fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​FindOperationsWithIncorrectReturnTypeResolveCorrectTypeCodeFix.cs Relocates the operation return-type fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​EvaluateManagedBackingFieldsCodeFix.cs Relocates the backing-field modifier fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​DoesOperationHaveAttributeAddAttributeCodeFix.cs Relocates the operation-attribute fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​DoesChildOperationHaveRunLocalRemoveAttributeCodeFix.cs Relocates the RunLocal-removal fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​Csla.Analyzers.CodeFixes.csproj Defines the non-packable code-fix project.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​CheckConstructorsAnalyzerPublicConstructorCodeFix.cs Relocates the public-constructor fix.
Source/​Csla.Analyzers/​Csla.Analyzers.CodeFixes/​AsynchronousBusinessRuleInheritingFromBusinessRuleChangeToBusinessRuleAsyncCodeFix.cs Relocates the asynchronous business-rule conversion fix.
Source/​Csla.Analyzers.sln Adds code fixes, corrects the test path, and expands platform mappings.

Review effort: Balanced

Comment thread Source/Csla.Analyzers.sln Resolved
- Delete Csla.Analyzers.Vsix: VS 2017-only, non-SDK project that no CI
  solution builds; the analyzers ship in the Csla package and can be
  debugged via the existing DebugRoslynComponent launch profile
- Rebuild Csla.Analyzers.sln from main with only Any CPU mappings,
  replacing the VSIX entry with Csla.Analyzers.CodeFixes
- Mark Csla.Analyzers IsPackable=false and drop its pack-only items and
  packages.config-era tools/install.ps1 and uninstall.ps1; the package
  was never published (its output never reaches bin/packages)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split analyzer and code fix projects

2 participants