Skip to content

fix: remove Workspaces dependency from core package - #29

Merged
ANcpLua merged 1 commit into
mainfrom
fix/remove-workspaces-from-core
Feb 7, 2026
Merged

fix: remove Workspaces dependency from core package#29
ANcpLua merged 1 commit into
mainfrom
fix/remove-workspaces-from-core

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move CodeFixProviderBase<T> and SyntaxModifierExtensions from core to Testing package
  • Remove Microsoft.CodeAnalysis.Workspaces.Common from core csproj
  • Both types had zero external consumers across the entire ecosystem

Problem

The core ANcpLua.Roslyn.Utilities package depends on Microsoft.CodeAnalysis.Workspaces.Common, which causes RS1038 errors in downstream analyzer projects (ANcpLua.Analyzers). With CentralPackageTransitivePinningEnabled=true, this dependency leaks into every project that references Roslyn.Utilities.

Root Cause

CodeFixProviderBase<T> was the only class in the core package that required Workspaces APIs (Document, CodeAction, CodeFixProvider). It belongs in the Testing package alongside the other test infrastructure.

Test plan

  • dotnet build succeeds with 0 errors, 0 warnings
  • dotnet nuget why confirms Workspaces.Common is no longer a dependency of core
  • No consumers of CodeFixProviderBase exist in ANcpLua.Analyzers, ErrorOrX, or any downstream repo
  • After merge + publish: update ANcpLua.Analyzers to use new version, verify RS1038 resolved

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Streamlined project dependencies for improved maintainability.

Move CodeFixProviderBase and SyntaxModifierExtensions from the core
package to Testing. These were the only consumers of
Microsoft.CodeAnalysis.Workspaces.Common in the core package and have
zero external consumers.

This eliminates Workspaces from the core package's transitive dependency
graph, fixing RS1038 errors in downstream analyzer projects that
reference ANcpLua.Roslyn.Utilities.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 7, 2026 20:10
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @ANcpLua, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the ANcpLua.Roslyn.Utilities project to improve its dependency hygiene. By identifying and relocating types that unnecessarily pulled in the Microsoft.CodeAnalysis.Workspaces.Common dependency, the core package is now leaner and avoids propagating unwanted transitive dependencies to consuming projects. This directly addresses a known issue causing build errors in related analyzer projects.

Highlights

  • Dependency Removal: The Microsoft.CodeAnalysis.Workspaces.Common package dependency has been removed from the core ANcpLua.Roslyn.Utilities project.
  • Code Relocation: The CodeFixProviderBase<T> and SyntaxModifierExtensions types, which were the sole reason for the Workspaces dependency, have been moved from the core ANcpLua.Roslyn.Utilities project to the ANcpLua.Roslyn.Utilities.Testing package.
  • Problem Resolution: This change aims to resolve RS1038 errors in downstream analyzer projects (like ANcpLua.Analyzers) that were caused by the transitive Workspaces.Common dependency when CentralPackageTransitivePinningEnabled=true.
Changelog
  • ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.csproj
    • Removed the Microsoft.CodeAnalysis.Workspaces.Common package reference.
  • ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities/CodeFixes/CodeFixProviderBase.cs
    • File renamed and moved to ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/CodeFixProviderBase.cs.
    • Added using System.Collections.Immutable; directive.
  • ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities/CodeFixes/SyntaxModifierExtensions.cs
    • File renamed and moved to ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/SyntaxModifierExtensions.cs.
Activity
  • The author has confirmed that dotnet build succeeds with no errors or warnings.
  • The author has verified using dotnet nuget why that Workspaces.Common is no longer a dependency of the core package.
  • The author has checked that no external consumers of CodeFixProviderBase exist in ANcpLua.Analyzers, ErrorOrX, or any other downstream repository.
  • A post-merge verification step is planned to update ANcpLua.Analyzers and confirm the RS1038 error is resolved after the new version is published.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai

coderabbitai Bot commented Feb 7, 2026

Copy link
Copy Markdown

Walkthrough

Two minimal changes: added a System.Collections.Immutable using directive to a test utility class and removed the Microsoft.CodeAnalysis.Workspaces.Common package dependency from the project file.

Changes

Cohort / File(s) Summary
Package Dependencies
ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.csproj
Removed Microsoft.CodeAnalysis.Workspaces.Common NuGet package reference.
Using Directives
ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/CodeFixProviderBase.cs
Added System.Collections.Immutable namespace import.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and accurately summarizes the main change: removing the Microsoft.CodeAnalysis.Workspaces.Common dependency from the core package, which is the primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/remove-workspaces-from-core

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request successfully removes the Microsoft.CodeAnalysis.Workspaces.Common dependency from the core ANcpLua.Roslyn.Utilities package by moving CodeFixProviderBase<T> and SyntaxModifierExtensions to the ANcpLua.Roslyn.Utilities.Testing package. The changes are logical and correctly address the problem of dependency leakage.

One important point to consider is that the namespaces of the moved files (CodeFixProviderBase.cs and SyntaxModifierExtensions.cs) have not been updated. They are still in the ANcpLua.Roslyn.Utilities.CodeFixes namespace. To align with .NET conventions and the new project structure, their namespaces should be updated to ANcpLua.Roslyn.Utilities.Testing.CodeFixes to match their new location within the ANcpLua.Roslyn.Utilities.Testing project. This will improve code organization and maintainability.

@@ -1,3 +1,4 @@
using System.Collections.Immutable;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For consistency with the established project style, consider making this a global using. Both the source project (ANcpLua.Roslyn.Utilities) and the destination project (ANcpLua.Roslyn.Utilities.Testing) use global usings. Instead of adding an explicit using here, you could add <Using Include="System.Collections.Immutable"/> to ANcpLua.Roslyn.Utilities.Testing.csproj. This would maintain a consistent approach to dependency management across projects and keep the code cleaner.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the Roslyn Workspaces dependency from the core ANcpLua.Roslyn.Utilities package by relocating the only Workspaces-dependent code-fix infrastructure types into the ANcpLua.Roslyn.Utilities.Testing package, preventing RS1038 issues from leaking into downstream analyzer projects via transitive dependencies.

Changes:

  • Removed Microsoft.CodeAnalysis.Workspaces.Common from the core utilities .csproj.
  • Moved CodeFixProviderBase<TSyntax> into the Testing package.
  • Moved SyntaxModifierExtensions (and ModifierPosition) into the Testing package.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.csproj Drops the transitive Workspaces dependency from the core package.
ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/SyntaxModifierExtensions.cs Adds the modifier manipulation helpers to the Testing package.
ANcpLua.Roslyn.Utilities/ANcpLua.Roslyn.Utilities.Testing/CodeFixes/CodeFixProviderBase.cs Adds the code-fix base class to the Testing package (Workspaces-dependent).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ANcpLua added a commit to ANcpLua/ANcpLua.Analyzers that referenced this pull request Feb 7, 2026
Two vectors caused Workspaces to leak into analyzer projects:

1. ANcpLua.Roslyn.Utilities transitively depends on Workspaces.Common
2. CSharp.Workspaces centrally defined + transitive pinning amplified it

Fix:
- Remove CSharp.Workspaces from central PackageVersion
- Add ExcludeAssets="all" for Workspaces.Common in analyzer projects
- Switch CodeFixes/Tests to VersionOverride for CSharp.Workspaces

Upstream fix: ANcpLua/ANcpLua.Roslyn.Utilities#29 removes Workspaces
from the core package entirely. Once published, these workarounds can
be reverted and CSharp.Workspaces restored to central management.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ANcpLua
ANcpLua merged commit 14d818e into main Feb 7, 2026
21 checks passed
@ANcpLua
ANcpLua deleted the fix/remove-workspaces-from-core branch February 7, 2026 20:19
ANcpLua added a commit to ANcpLua/ANcpLua.Analyzers that referenced this pull request Feb 7, 2026
Roslyn.Utilities 1.31.0 removes Microsoft.CodeAnalysis.Workspaces.Common
from the core package (CodeFixProviderBase moved to Testing). This
eliminates the transitive Workspaces dependency that caused 169 RS1038
errors in analyzer projects.

No workarounds needed — clean version bump resolves the issue at source.

Upstream: ANcpLua/ANcpLua.Roslyn.Utilities#29

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ANcpLua added a commit to ANcpLua/ANcpLua.Analyzers that referenced this pull request Feb 7, 2026
Roslyn.Utilities 1.31.0 removes Microsoft.CodeAnalysis.Workspaces.Common
from the core package (CodeFixProviderBase moved to Testing). This
eliminates the transitive Workspaces dependency that caused 169 RS1038
errors in analyzer projects.

No workarounds needed — clean version bump resolves the issue at source.

Upstream: ANcpLua/ANcpLua.Roslyn.Utilities#29

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants